Hello!
I was asked if it is possible to get the screen coordinates of the surrounding rectangle from the value in the XamPropertyGrid. (Picture red rectangle)
Does anyone know how to do this?
Thanks for the help,
Jan
Hello Jan,
The MouseDown is a bubbling event and it could be handled by an element of the visual tree (e.g. the editor) before it gets to the XamPropertyGrid. I would suggest you to use the PreviewMouseDown event in this scenario and apply the custom logic there.
Hello Maria,
Thanks for the help. I have one more problem. I hooked up MouseDown event in the PropertyGrid. This event does not appear every time when I click on the PropertyGrid to change a value. I get this event only when I click on Borders or on a disabled property.
Is there a way to get any event when I click on a property value?
I will add a small sample application.
Thanks, Jan
You can go through the visual tree to get the border of the PropertyGridPropertyItem that you need and then use the PointToScreen method to get the location as it is described in the following forum thread: https://social.msdn.microsoft.com/Forums/vstudio/en-US/281a8cdd-69a9-4a4a-9fc3-c039119af8ed/absolute-screen-coordinates-of-wpf-user-control?forum=wpf
Please do not hesitate to let me know if you have any questions.