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

Parents
No Data
Reply
  • 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.

Children
No Data