How can I see a separator in the menu bar ?

2 posts, 0 answers
  1. Michel
    Michel avatar
    39 posts
    Member since:
    Jul 2011

    Posted 17 Aug 2011 Link to this post

    I use the MenuItem IsSeparator sucessfully in dropdown menus but the separator is not showing when used in the main menu bar...

    <Menu>
       <MenuItem ... />
       <MenuItem IsSeparator="True" ... />
       <MenuItem ... />
    </Menu>

    EDIT: I added a default style for the menu item and it now displays a "horizontal" separator bar... How can I make this bar vertical ?
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 19 Aug 2011 Link to this post

    Hello Michel,

    Currently the RadMenuItem does not support orientation for the role Separator. By default, it has vertical orientation, i.e. it is meant for use in vertical scenarios. When using it as a horizontal separator, you will have to apply a small change to its template. For example, please consider the following snippet:

    <Window.Resources
            <ControlTemplate x:Key="SeparatorTemplate" TargetType="telerik:RadMenuItem"
                <Grid HorizontalAlignment="Stretch">                 
                        <Rectangle Fill="Red" Height="20" Width="1" VerticalAlignment="Stretch"/> 
                        <Rectangle Fill="Blue" Height="20" Width="1" VerticalAlignment="Stretch"/>               
                </Grid
            </ControlTemplate>   
    </Window.Resources>     
        
    <Grid x:Name="LayoutRoot" Background="White"
            <telerik:RadMenu x:Name="radMenu" ClickToOpen="False" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="8,8,0,0"
                <telerik:RadMenuItem Header="File"/> 
                <telerik:RadMenuItem Header="Edit" IsSeparator="True" Template="{StaticResource SeparatorTemplate}" />              
                <telerik:RadMenuItem Header="View" />            
            </telerik:RadMenu
    </Grid>

    The above example displays a horizontal separator.

    I hope this will give you some helpful insight on the issue.

    Regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top