1

Why the MouseLeftButtonUp event for the stackpanel is not fired?? The mouseLeftButtonDown event happens but not the ButtonUP.

<StackPanel x:Name="close_btn" Grid.Row="1" Grid.Column="0" Orientation="Vertical" Height="41" HorizontalAlignment="Left"  Width="19" VerticalAlignment="Top" >
    <Button Height="19" Width="19"  Click="Button_Click">
        <Button.Template>
            <ControlTemplate TargetType="Button">
                <StackPanel>
                    <Image Name="image1" Source="..\..\Images\ixs.png" Stretch="Fill" Height="19" Width="19" Visibility="Collapsed" />
                    <Image Name="image2" Source="..\..\Images\ixs-hover.png" Stretch="Fill" Height="19" Width="19" Visibility="Visible" />
                </StackPanel>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver"
          Value="true">
                        <Setter TargetName="image1"
          Property="Visibility"
          Value="Visible" />
                        <Setter TargetName="image2"
          Property="Visibility"
          Value="Collapsed" />
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Button.Template>
    </Button>
    <StackPanel PreviewMouseLeftButtonDown="image3_MouseLeftButtonDown" PreviewMouseLeftButtonUp="image3_MouseLeftButtonUp">
        <Image   Name="image3" Source="..\..\Images\movit.png" Stretch="Fill" Height="22" Width="19" />
    </StackPanel>

</StackPanel>
Sivasubramanian
  • 935
  • 7
  • 22
User9898
  • 251
  • 1
  • 3
  • 11
  • What are you trying to do in MouseLeftButtonUp ?? What is your requirement?? – Sivasubramanian Jan 28 '16 at 12:08
  • 1
    Do you open any dialog or window in MouseLeftbuttonDown event ?? – Sivasubramanian Jan 28 '16 at 12:19
  • This is a tricky problem. If you get rid of `PreviewMouseLeftButtonDown` you'll find that button up will start working. I don't know the full reason for this. Here is a link to a similar issue: [link](http://stackoverflow.com/questions/12496258/mouseleftbuttonup-does-not-fire) – dev1998 Jan 28 '16 at 18:16

0 Answers0