I am trying to get all submenu items when submenuopened event raises. I didn't find any proper solution. Can you please help me in this.
Hello,
Did you have a chance to look at project I have attached in my previous response? When you use the HierarchicalItemTemplate in XamMenu you are able to handle the SubMenuOpened only in the DefaultItemsContainer's Template. It would not be raised for the XamMenuItems inside the HierarchicalDataTemplate. The XamMenuItem's Items property contains an ItemsCollection used to generate the submenus based on the ItemSource you are using. The submenu is made up of the objects within the ItemCollection(the underlying objects from the ItemSource).
Let me know if you need any further assistance.
Sincerely,ZhivkoAssociate Software Developer
I am am able handle submenu opened event. At this stage from sender(Parent XamMenu item). I am not able to get child xamMenu items.
There is field called items where it has datacontext where i am expecting list of xamMenu Items(children).
So, Please provide solution to get xamMenu Items(children)
Thanks
When you are using the HerarchicalDataTemplate the SubmenuOpened event could be handled in DefaultItemsContainer's XamMenuItem, this way it will fire only for root level items and XamMenuItem.Items will contains your DataItem instead of XamMenuItems. In order to get all sub items you can store the root item by using the sender from SubmenuOpened. Then you can handle MouseEnter event of XamMenuItem. In the event handler you are able to check on which XamMenuItem is located the mouse and call the recursive method that will find all sub DataItems.
I have attached a sample application, where you can test this approach.
Can someone please look into this issue. The solution is not working when we use Hierarchical data template inside XamMenu. Please look into this ASAP.
How to achieve same when we are using Hierarchical DataTemplate.
<ig:XamMenu.HierarchicalItemTemplate> <ig:HierarchicalDataTemplate ItemsSource="{Binding ProductVariantList}"> <DataTemplate>
<ig:XamMenuItem Header="{Binding Path=ProductTypeName}" Focusable="True" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White"> <ig:XamMenuItem.InputBindings> <MouseBinding Command="{Binding ProductCommand}" MouseAction="LeftClick" /> </ig:XamMenuItem.InputBindings> </ig:XamMenuItem>
</DataTemplate>
<ig:HierarchicalDataTemplate.ItemTemplate> <DataTemplate> <ig:XamMenuItem Header="{Binding Path=ProductVariantName}" Focusable="True" HorizontalContentAlignment="Left" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White"> <ig:XamMenuItem.InputBindings> <MouseBinding Command="{Binding ProductVariantSelectCommand}" MouseAction="LeftClick" /> </ig:XamMenuItem.InputBindings> </ig:XamMenuItem> </DataTemplate> </ig:HierarchicalDataTemplate.ItemTemplate>