I am using XamMenu for our primary application menu. Rather than hard code or add all the menus on the fly I want to use data binding. Our application menus are currently defined in XML. I can use linq to put them in an object graph if needed.
Reading the docs it talks about creating a hierarchal template but seems to say you need to create one for each menu level you need. Our menu structure is 100% defined in the XML.
First, is it possible to bind to XML or will I need to bind to an object graph.
Are there any examples of fully data driven XamMenus with random level depths.
BOb
The same XMAL worked to load the Menu items. but how this will work with the command.
I tried this way
<i:Interaction.Triggers> <i:EventTrigger EventName="ItemClicked"> <i:InvokeCommandAction Command="{Binding Path=SwitchPageCommand}" CommandParameter="{Binding Path=MenuName}" /> </i:EventTrigger> </i:Interaction.Triggers>
AND
<ig:XamMenuItem.InputBindings> <MouseBinding MouseAction="LeftClick" Command="{Binding Path=SwitchPageCommand}" CommandParameter="{Binding Path=MenuName}" /> </ig:XamMenuItem.InputBindings>
both the way but its not firing the event and not giving the parameter values. Can you help me on it
Bob,
One of the developers informed me that we were neglecting to use the DefaultItemsContainer to host our DataTemplate for the XamMenuItem. An example is posted in our forums in a thread entitled "Horizontal XamMenu Data binding with Hierarchical Data" at this address: https://es.infragistics.com/community/forums/f/retired-products-and-controls/49840/horizontal-xammenu-data-binding-with-hierarchicaldata/264957#264957
I believe the proper markup in my own sample should be the following...
<ig:XamMenu Name="xamMenu1" ItemsSource="{Binding MenuItems }"> <ig:XamMenu.HierarchicalItemTemplate > <ig:HierarchicalDataTemplate ItemsSource="{Binding Children }"> <ig:HierarchicalDataTemplate.DefaultItemsContainer > <DataTemplate > <ig:XamMenuItem /> </DataTemplate > </ig:HierarchicalDataTemplate.DefaultItemsContainer > <ig:HierarchicalDataTemplate.ItemTemplate > <DataTemplate > <TextBlock Text="{Binding MenuTitle }"/> </DataTemplate > </ig:HierarchicalDataTemplate.ItemTemplate > <DataTemplate > <TextBlock Text="{Binding MenuTitle }"/> </DataTemplate > </ig:HierarchicalDataTemplate > </ig:XamMenu.HierarchicalItemTemplate > </ig:XamMenu >
Just wanted to let you know that this topic is being discussed between myself and my colleagues. I will let you know our findings as soon as I can.
Thanks,
Thanks Bob....I'll look into this and get back to you shortly.
Ok a question.. all I get is text blocks in the menu. Shouldn't they be XamMenu items. I need to set the Header and NavigationUri along with a right click event handler. The "menu" displays but it doesn't do anything.