我正在尝试学习MouseLeftButtonDown的工作原理,但直到现在都没有成功。
当我点击按钮时,什么也没发生。
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<StackPanel Name="sss">
<Button x:Name="b1" Height="213" MouseLeftButtonDown="sss_MouseDown"/>
</StackPanel>
</Grid>
</Window>
代码后台是:
private void sss_MouseDown(object sender, MouseButtonEventArgs e)
{
MessageBox.Show("3 ->>>>>" + ((Control)sender).Name);
}