Horizontal Menu separators

3 posts, 1 answers
  1. Alexey Oyun
    Alexey Oyun avatar
    74 posts
    Member since:
    Mar 2010

    Posted 09 Dec 2010 Link to this post

    Hi,

    When user adds items to horizontal menu component and sets one of the items as separator. He gets separator drawn with horizontal line, and it looks bad.

    I know I can change it through styles, but it still feels somewhat hacky.
    May be it could be better to provide horizontal and vertical separator styles by default.

    Thanks, Alexey.

  2. Answer
    Dani
    Admin
    Dani avatar
    848 posts

    Posted 14 Dec 2010 Link to this post

    Hello Alexey ,

    You can easily edit the separator template using the SeparatorTemplateKey property. Consider the following example:

    <UserControl.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>  
    </UserControl.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" SeparatorTemplateKey="{StaticResource SeparatorTemplate}" Height="28" Width="22" HorizontalAlignment="Left"/>             
                <telerik:RadMenuItem Header="View" />           
            </telerik:RadMenu>
    </Grid>

    I hope this will help you achieve the desired effect.

    Kind regards,
    Dani
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Alexey Oyun
    Alexey Oyun avatar
    74 posts
    Member since:
    Mar 2010

    Posted 14 Dec 2010 Link to this post

    Thanks for your replay, I saw thread about separator template.

    For now, I just check if I should replace separators (If horizontal root items), if yes then I change their type to normal but disabled item with "separator" icon.

    And it still hacky code :)

    Sincerelly, Alexey.
Back to Top