I have started Silverlight applications recently. I have created one silverlight application in which I have added two rectangle shapes through code and also implemented Mouse button events for these rectangles. But when I take Rectangle Geometry instead of Rectangle shape, I am not getting events to associate to them.
Can anyone tell me how can I handle events for Geometry shapes?
Thanks & Regards
Padma
Loading
Praveen KumarPosted Jul 15, 2010, 4:19 AM
padmavathi gudipatiPosted Jul 15, 2010, 3:12 AM
Praveen KumarPosted Jul 15, 2010, 2:47 AM
XAML:
<Grid x:Name="LayoutRoot" Background="White">
<Canvas>
<Path Fill="Red" Stroke="Black" StrokeThickness="1" MouseLeftButtonDown="mymouselbd">
<Path.Data>
<RectangleGeometry Rect="100,100,250,250" />
Path.Data>
Path>
Canvas>
Grid>
Code behind:
private void mymouselbd(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
MessageBox.Show("Clicked on Rectangle");
}