I
Ilyas
Hi all
I have the following xaml
<UniformGrid MouseDown="UniformGrid_MouseDown">
<Button Name="btn0">Hello</Button>
<Button Name="btn1">
<Button.Template>
<ControlTemplate>
<Rectangle Fill="Red" Stroke="Yellow"
Opacity="0.7" StrokeThickness="5"></Rectangle>
</ControlTemplate>
</Button.Template>
</Button>
<Button Name="btn2">
<Button.Template>
<ControlTemplate>
<Ellipse Fill="Green" Stroke="Violet"
Opacity="0.7" StrokeThickness="5"></Ellipse>
</ControlTemplate>
</Button.Template>
</Button>
</UniformGrid>
and the following code for the code behind
private void UniformGrid_MouseDown(object sender,
MouseButtonEventArgs e)
{
FrameworkElement elm = e.OriginalSource as
FrameworkElement;
MessageBox.Show("You clicked " + elm.Name);
}
Why is it that the events are never raised? I want to catch all button
mousedown events (ideally I would like to catch the click event for
buttons) in a global handler...how do i do this?
I have the following xaml
<UniformGrid MouseDown="UniformGrid_MouseDown">
<Button Name="btn0">Hello</Button>
<Button Name="btn1">
<Button.Template>
<ControlTemplate>
<Rectangle Fill="Red" Stroke="Yellow"
Opacity="0.7" StrokeThickness="5"></Rectangle>
</ControlTemplate>
</Button.Template>
</Button>
<Button Name="btn2">
<Button.Template>
<ControlTemplate>
<Ellipse Fill="Green" Stroke="Violet"
Opacity="0.7" StrokeThickness="5"></Ellipse>
</ControlTemplate>
</Button.Template>
</Button>
</UniformGrid>
and the following code for the code behind
private void UniformGrid_MouseDown(object sender,
MouseButtonEventArgs e)
{
FrameworkElement elm = e.OriginalSource as
FrameworkElement;
MessageBox.Show("You clicked " + elm.Name);
}
Why is it that the events are never raised? I want to catch all button
mousedown events (ideally I would like to catch the click event for
buttons) in a global handler...how do i do this?