0

I want to add a grid in a grid at click position . that grid have a usercontrol as its content. On click event in the main grid i get the with respect to that grid through this code :

Dim mousePositin As Point 
mousePosition = Mouse.GetPosition(gridFloorPlans)

and after that i addaed the child grid through this code :

Dim UC As New UserControl1
Dim gr As New Grid

gr.Children.Add(UC)
gr.Height = 31
gr.Width = 31

Dim thick As New Thickness
thick.Left = mousePosition.X
thick.Top = mousePosition.Y
gr.Margin = thick

gridFloorPlans.Children.Add(gr)

the problem is this the grid is added but not on that position much far away from the position . whats the problem? how can i do this correctly ?

daniele3004
  • 13,072
  • 12
  • 67
  • 75
pasha pash
  • 99
  • 11

0 Answers0