Hi,
I am trying to get the selected tile on mouse up. As the close/maximize buttons on tile are also part of the tile the close/maximize button clicks are not getting triggered.
What is the way to get the UIElement that is at mouse point to check if user has clicked the Header portion or Close/maximize button?
In my attached sample I am expecting the Tile to be closed when used clicks on close button. Can anyone please help out.
Hello Prasad,
I am just checking if you have any further questions on this matter. Please do not hesitate to let me know if you do.
I have been looking into your post.
I can suggest using the handle the PreviewMouseLeftButtonDown event of the TileHeaderPresenter. Then using the Utilities class you can get the Header(a TextBlock) of the XamTile and the Close button. When you get them you can check their IsMouseOver property.
I have modified the sample application with the above mentioned functionality for you. Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
Thank you for the information.
Some of the things are giving just high level control as XamTilemanager/HeaderPresenter. The maximize & close buttons are part of Header and are not controls added to control collection. Using WPF Visual Tree and other I am getting only Tile manager. Mouse.DirectlyOver and other properties are giving the base control as Button, TextBox etc., but not able to get information of tile from the button/textbox.
If possible can you show me a sample code on how to distinguish Tile Header Click, Close Button Click & Maximize Button Click when user mouse down/up on a XamTile ?
Thanks & Regards,
Prasad
Hello nknprasad,
If you want to take the element that is directly under the mouse cursor I can suggest to take a look at the following link, where this functionality is discussed:
http://stackoverflow.com/questions/586479/is-there-a-quick-way-to-get-the-control-thats-under-the-mouse ,
http://stackoverflow.com/questions/45813/wpf-get-elements-under-mouse ,
https://msdn.microsoft.com/en-us/library/system.windows.input.mouse.directlyover(v=vs.110).aspx ,
https://msdn.microsoft.com/en-us/library/system.windows.uielement.ismouseover(v=vs.110).aspx .
Please do not hesitate to let me know if you have any further questions on this matter.