public ControlTemplate SeparatorTemplateKey {get;set}

1 Answer 15 Views
Menu
anna
Top achievements
Rank 1
Bronze
Iron
anna asked on 26 Apr 2025, 06:45 AM

Hello

Question  about ===> public ControlTemplate SeparatorTemplateKey {get;set}

 

I don't know how to use (public ControlTemplate SeparatorTemplateKey {get;set}

). Please teach me.
I don't know how to use (public ControlTemplate SeparatorTemplateKey {get;set}

), so it's very difficult for me.

 

 

<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>

 

 

--------

using System.Windows.Controls;
public override ObservableCollection<MenuItem> GetMenu()
{
    var contextmenuitem = new ObservableCollection<MenuItem>(); 
    var eRNode = crateMenuItem("Report");
    eRNode.Items.Add(createMenuItem("Sub"));
  
    contextmenuitem.Add(Separate); <===
    ControlTemplate template = new ControlTemplate();
    template.key = "Tamplate";
    contextmenuitem.Add(SeparatorTemplateKey(template)); <===ControlTemplate x:Key="Template" OF XAML.xaml File .... <==I don't know grammar. How do I write code?
    contextmenuitem.Add(eRNode);
}

 

 

 

 

anna
Top achievements
Rank 1
Bronze
Iron
commented on 28 Apr 2025, 12:59 AM | edited

I am a genuine Teleric license user. I bought it about 10 years ago, but I lost the license.

I discourage using telerics because they don't answer questions.
Knowledge is better developed when you ask and answer questions about different ideas.

Teleric is stingy with answers.
If you save knowledge, there is no progress.


I tell others not to use telerics.

anna
Top achievements
Rank 1
Bronze
Iron
commented on 28 Apr 2025, 01:02 AM

there is no detail manual

 

Martin Ivanov
Telerik team
commented on 28 Apr 2025, 07:51 AM

Hello Anna, please note that the forums are not part of the Telerik's support services. They are a free community based resource and Telerik doesn't promise answers in the forum. We often join the forum conversations, but we are not obligated to do so. If you need guaranteed answers for your technical queries, I strongly suggest you to purchase a support plan and use the Telerik's ticketing support service.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 28 Apr 2025, 07:47 AM

Hello Anna,

The SeparatorTemplateKey was obsolete back in 2013 and I suggest you to no use it. Instead, use the RadMenuSeparatorItem.

<telerik:RadMenu> 
            <telerik:RadMenuItem Header="File"/> 
            <telerik:RadMenuSeparatorItem />              
            <telerik:RadMenuItem Header="View" />            
</telerik:RadMenu> 


contextmenuitem.Add(new RadMenuSeparatorItem ());

If you need to customize the default ControlTemplate of the separator, you can use the following steps:

  1. Go to your Telerik UI for WPF installation folder and find the "Themes.Implicit" folder.
  2. In the "Themes.Implicit" folder find the Telerik.Windows.Controls.Navigation.xaml file for the Telerik theme you are using. Read more here.
  3. In the .xaml file find the "SeparatorTemplate" ControlTemplate and copy it in the resources of your application (for example, in Application.Resources or MainWindow.Resources tag).
  4. Modify the ControlTemplate as you need and apply it using the Template property of RadMenuSeparatorItem.
     <telerik:RadMenuSeparatorItem Template="{StaticResource MyCustomizedSeparatorTemplate}"/>              

    contextmenuitem.Add(new RadMenuSeparatorItem ()
    {
        Template =  this.Resources["MyCustomizedSeparatorTemplate"] as ControlTemplate  // where "this" points to the MainWindow
    });

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

anna
Top achievements
Rank 1
Bronze
Iron
commented on 28 Apr 2025, 11:39 AM | edited

I am a genuine RadControl license user. I bought it about 10 years ago, but I lost the license.

 

Martin Ivanov
Telerik team
commented on 28 Apr 2025, 12:36 PM

Please note that the Telerik license for the version you bought 10 years ago grants you unlimitted access only to the product downloads, but not the support service. This is a subscription based service with one year of active period. Once the year passes, you need to buy a new support package. 

This information is available on the Support Plans page:


Tags
Menu
Asked by
anna
Top achievements
Rank 1
Bronze
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or