Hi,
I'm filling a XamMenu with data binding.
I'd like to insert a separator based on the value of a property.
To achieve that I use a conditional DataTemplate :
<DataTemplate x:Key="MenuDataTemplate"> <Border> <TextBlock Text="{Binding Path=Description}" /> </Border> </DataTemplate> <DataTemplate x:Key="SeparatorMenuDataTemplate"> <Canvas HorizontalAlignment="Left" Width="0" ClipToBounds="False"> <Line Stroke="Black" X2="10000"/> </Canvas> </DataTemplate> <DataTemplate x:Key="MenuChoiceDataTemplate"> <ContentControl Content="{Binding}"> <ContentControl.Style> <Style TargetType="ContentControl"> <Style.Triggers> <DataTrigger Binding="{Binding IsSeparator}" Value="False"> <Setter Property="ContentTemplate" Value="{StaticResource MenuDataTemplate}" /> </DataTrigger> <DataTrigger Binding="{Binding IsSeparator}" Value="True"> <Setter Property="ContentTemplate" Value="{StaticResource SeparatorMenuDataTemplate}" /> </DataTrigger> </Style.Triggers> </Style> </ContentControl.Style> </ContentControl> </DataTemplate>
The menu :
<ig:XamMenu x:Name="MainMenu" DockPanel.Dock="Top" VerticalAlignment="Top" MenuOrientation="Horizontal" ItemsSource="{Binding MenuItems}" ItemTemplate="{StaticResource MenuDataTemplate}" > <ig:XamMenu.HierarchicalItemTemplate> <ig:HierarchicalDataTemplate ItemsSource="{Binding Path=Children}" ItemTemplate="{StaticResource MenuChoiceDataTemplate}"> <ig:HierarchicalDataTemplate.DefaultItemsContainer> <DataTemplate> <ig:XamMenuItem Command="{Binding ClickCommand}" /> </DataTemplate> </ig:HierarchicalDataTemplate.DefaultItemsContainer> <ig:HierarchicalDataTemplate.HierarchicalItemTemplate> <ig:HierarchicalDataTemplate ItemsSource="{Binding Path=Children}" ItemTemplate="{StaticResource MenuChoiceDataTemplate}"> <ig:HierarchicalDataTemplate.DefaultItemsContainer> <DataTemplate> <ig:XamMenuItem Command="{Binding ClickCommand}"/> </DataTemplate> </ig:HierarchicalDataTemplate.DefaultItemsContainer> </ig:HierarchicalDataTemplate> </ig:HierarchicalDataTemplate.HierarchicalItemTemplate> </ig:HierarchicalDataTemplate> </ig:XamMenu.HierarchicalItemTemplate> </ig:XamMenu>
I works but the look of the separator is not the same as the default.
So, I wonder if you could provide me the default style for that XamMenuSeparator ?
Thanks in advance
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.