Hi,
We are using RadMenu on a solution with wpf and telerik on this way:
Here is the element menu:
<telerik:RadMenu x:Name="MenuPrincipal" ItemsSource="{Binding MenuItems}"
ItemContainerStyle="{StaticResource MenuItemStyle}" > </telerik:RadMenu>
Styles:
<UserControl.Resources>
<Style x:Key="MenuItemStyle" TargetType="telerik:RadMenuItem">
<Setter Property="Command" Value="{Binding Command}" />
<Setter Property="CommandParameter" Value="{Binding CommandParameter}" />
<Setter Property="Header" Value="{Binding Header}" />
<Setter Property="ItemsSource" Value="{Binding Items}"/>
<Setter Property="IsSeparator" Value="{Binding IsSeparator}"/>
</Style>
</UserControl.Resources>
The item collection are generated like a ObservableCollection of our own class with header, subitems, and everything it´s working fine. The Menu it´s appearing ok on the screen and showing correctly the childs and parents. The relation between parents and childs inside the RadMenu Items are working fine :)
The problem is... now, i need to add a RadContextMenu on some items of the menu, and i don´t know how to do it. I´m trying to do on several ways, but nothing it´s working properly.
First try:
<telerik:RadMenu x:Name="MenuPrincipal" VerticalAlignment="Top" ItemsSource="{Binding MenuItems}"
ItemContainerStyle="{StaticResource MenuItemStyle}" >
<telerik:RadMenu.ItemTemplate >
<DataTemplate>
<telerik:RadMenuItem Header="{Binding}" ContextMenuOpening="RadMenuItem_ContextMenuOpening" >
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu>
<telerik:RadMenuItem Header="{Binding }"/>
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
</telerik:RadMenuItem>
</DataTemplate>
</telerik:RadMenu.ItemTemplate>-->
</telerik:RadMenu>
That way, creates the menu item like a button (with a border...) and it´s not responding on click. (If i click outside the border the menu displays). I can Solve with "autoopen", but in that way, when the context menu has showed, the menu closes, also whit "stayopen" property enabled.
Second Try
With codebehind - Trying to add a RadContextMenu on our own class of the menu and binding on that way <Setter Property="ContextMenu" Value="{Binding ContextMenu}"/> Not succesfull :(
Also to consider. I need to show the menu only in the final childs, not in the parent menus...
Any help will be appreciated.
Thank you, regards.