次のコードがあり、画像をクリックしても Click イベントが発生しません。画像の外側をクリックすると、ボタン クリック イベントが発生します。
XAML:
<Grid x:Name="LayoutRoot" Background="White">
<Button x:Name="btnMain" Background="Purple" >
<StackPanel x:Name="spButtonPanel" Background="Black">
<telerik:RadImageEditor x:Name="imgButtonImage" />
<TextBlock x:Name="tbButtonText" />
</StackPanel>
</Button>
</Grid>
CS:
this.btnMain.Click += new RoutedEventHandler(btnMain_Click);
this.imgButtonImage.MouseLeftButtonDown += new MouseButtonEventHandler(imgButtonImage_Click);
this.spButtonPanel.MouseLeftButtonDown += new MouseButtonEventHandler(spButtonPanel_Click);
x_Click イベントでは、単純に MessageBox.Show("Button clicked"); です。xはbtn_Mainなどです...
画像をクリックしても imgButtonImage_Click は起動しません。ZIndex を無駄に変更しようとしました。