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
Mouse Events for Geomtry shapes in Silverlight
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Praveen KumarRank #4 · 79.9K reputationPosted Jul 14, 2010, 10:47 PM EDT
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");
}
padmavathi gudipati17 reputationPosted Jul 14, 2010, 11:12 PM EDT
Praveen KumarRank #4 · 79.9K reputationPosted Jul 15, 2010, 12:19 AM EDT