This is a migrated thread and some comments may be shown as answers.

Horizontal Menu separators

2 Answers 85 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Alexey Oyun
Top achievements
Rank 1
Alexey Oyun asked on 09 Dec 2010, 12:25 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Dani
Telerik team
answered on 14 Dec 2010, 09:03 AM
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
0
Alexey Oyun
Top achievements
Rank 1
answered on 14 Dec 2010, 09:12 AM
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.
Tags
Menu
Asked by
Alexey Oyun
Top achievements
Rank 1
Answers by
Dani
Telerik team
Alexey Oyun
Top achievements
Rank 1
Share this question
or