Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1320
XamMenuSeparator default style
posted

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

  • 138253
    Offline posted

    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.

  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I can say that the default Style for the XamMenuSeparator is located here by default:

     

    C:\Program Files (x86)\Infragistics\2014.2\WPF\DefaultStyles\Menu\generic.xaml file

     

    Please let me know if this helps you or you have further questions on this matter.

     

    Looking forward for your reply.