为什么在这种情况下MouseLeftButtonUp事件未被触发

时间:2016-01-28 11:44:02

标签: c# wpf

为什么不会触发stackpanel的MouseLeftButtonUp事件?发生了mouseLeftButtonDown事件,但没有发生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>

0 个答案:

没有答案