Sorry folks i couldn' t find a link for posting Xaml Question...
Iam trying this thing.... and now im new to XAML...
What im trying to do is just put a ellipse at a specified location....
when clicked inside a grid.... (i dont put the ellipse inside any row or column of grid just over it)
when im doing this in a window ... it works and functions fine....
but when i put the same functionality inside a user control......
and then incorporate the user control inside the window.... the ellipse gets drawn at some other location other than the mouse position.......
Can anyone give any hints as to why this is happening.....
im using this code inside the user control to place the ellipse
Iam trying this thing.... and now im new to XAML...
What im trying to do is just put a ellipse at a specified location....
when clicked inside a grid.... (i dont put the ellipse inside any row or column of grid just over it)
when im doing this in a window ... it works and functions fine....
but when i put the same functionality inside a user control......
and then incorporate the user control inside the window.... the ellipse gets drawn at some other location other than the mouse position.......
Can anyone give any hints as to why this is happening.....
im using this code inside the user control to place the ellipse
Code:
private void Grid1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Ellipse el = new Ellipse();
el.Fill = Brushes.Goldenrod;
el.Stroke = Brushes.IndianRed;
el.Height = 20;
el.Width = 20;
el.Margin = new Thickness(e.GetPosition(this).X-20, e.GetPosition(this).Y, 0, 0);
Grid1.Children.Add(el);
}