に動作していない - Window1.xamlLeftMouseButtonDownは、私はWPFのルーティングイベントについて学んでいたと私は、次の例をしようと、</p> <p>ファイルルーティングイベントにボタンで
<ScrollViewer VerticalScrollBarVisibility="Auto">
<UniformGrid MouseDown="UniformGrid_MouseDown">
<Button x:Name="Button1">1</Button>
<Button x:Name="Button2">2</Button>
<Button x:Name="Button3">3</Button>
<Button x:Name="Button4">4</Button>
<Button x:Name="Button5">5</Button>
<Button x:Name="Button6">6</Button>
<Button x:Name="Button7">7</Button>
<Button x:Name="Button8">8</Button>
<Button x:Name="Button9">9</Button>
</UniformGrid>
</ScrollViewer>
ファイル - Window1.xaml私はこれらのスニペットを実行したときには.cs
private void UniformGrid_MouseDown(object sender, MouseButtonEventArgs e)
{
Button aTargetButton = e.Source as Button;
if (aTargetButton != null)
{
aTargetButton.Background = Brushes.Azure;
aTargetButton.LayoutTransform = new RotateTransform(45);
if (myPreviouslyClickedButton != null)
{
myPreviouslyClickedButton.Background = Brushes.White;
myPreviouslyClickedButton.LayoutTransform = new RotateTransform(0);
}
myPreviouslyClickedButton = aTargetButton;
}
}
、対応するボタンは、私は(私はMouseDownイベントのために加入しているにもかかわらず)その上で右クリックを行うだけ角度変換を受けます。これで私を助けてくれますか?
更新:
このコードは、私は楕円形で、ボタンを置き換える場合は動作するようです。楕円ができるときにボタンが左クリックに反応しないのはなぜですか?同じ楕円をもう一度クリックするとイベントが発生しません