Having trouble getting help?
Contact Support
Contact Support
Customizing Data Templates in WPF Menu (MenuAdv)
6 May 20211 minute to read
Data templates can be customized for items of the MenuAdv control. The next section explains how to customize the MenuItemAdv using data templates.
Item Template
You can customize how a business object is displayed as MenuItemAdv using ItemTemplate of MenuAdv. The MenuAdv displays hierarchical data. HierarchicalDataTemplate is used to define the ItemTemplate. The following code example shows the usage of ItemTemplate.
<syncfusion:MenuAdv ItemsSource="{Binding MenuItems}" >
<syncfusion:MenuAdv.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding SubItems}">
<StackPanel Orientation="Horizontal">
<Image Source="App.ico" Width="15" Height="15"/>
<TextBlock Text="{Binding Header}" FontWeight="Bold" FontStyle="Italic" />
</StackPanel>
</HierarchicalDataTemplate>
</syncfusion:MenuAdv.ItemTemplate>
</syncfusion:MenuAdv>
NOTE
Implementing the above code will generate the following MenuAdv control.