I have attached a simple VS solution demonstrating the issues we are having getting the XamMenu to look and work as we require.
I have the following questions (you can see my attempt at resolving them in the attached solution, but it is klugey so I need some help determining the recommended approach):
(1) How can I get that a root menu item was clicked and cancel the dropdown menu?(2) I have a composite root menu item consisting of a one row three column grid, column 0 = TextBlock and column 2 = Button (column 1 is empty to provide space between the two controls). I only want the subitems to drop down if the user clicks the button in column 1 (which has a dropdown indicator). But anywhere I click causes the click event for the menu item to fire.(3) How can I add tooltips to the root menuitems that only display when the root menuitem has its TextTrimmed?(4) When a root item is clicked, how can I make its text Bold and make sure all the other root elements are not bold? Related, how do I keep the root element's submenu items from inheriting the bold (i.e. just want the root to be bold, children should remain normal font weight)?
Thanks for any help,
Pat
Hello Pat,
Thank you for your post. I have been looking into your questions.
Regarding your first question you can use the default style for the xamMenu and change the visual state and the Opacity property for the SubMenuOpen from “1.0” to “0.0” and for the SubMenuOpenImmediately too. Then you can handle the PreviewMouseDown event, get the MenuItem and check if it has children. If it has you can apply the changed default style.
For your second requirement would you please change the sample application you have attached in your initial post to show the mentioned functionality?
For your third requirement you can create a style with a Key for the XamMenuItem and set the FontWeight property to bold. Then handle the ItemClicked event and apply the style for this item.
Hi,
Sorry but could you provide a sample for "Regarding your first question you can use the default style for the xamMenu and change the visual state and the Opacity property for the SubMenuOpen from “1.0” to “0.0” and for the SubMenuOpenImmediately too. Then you can handle the PreviewMouseDown event, get the MenuItem and check if it has children. If it has you can apply the changed default style.". I can find the xamMenu default style but I don't see SubMenOpen or SubMenuOpenImmediately sections or know where I would add them?
Thank you,
I am just checking if my last reply was helpful for you.
If you require any further assistance, please do not hesitate to ask.
Hi Pat,
I have attached a xaml file where the default style for the XamMenu and XamMenuItem are modified in order to set the Opacity property of SubMenuOpen and SubMenuOpenImmediately states to 0. I have also added animation for the Visibility property so that the border is not displayed at all. The modified section is separated by comments. Please feel free to let me know if you need further assistance.