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

[Solved] RadMenuItem Container

3 Answers 126 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Harald Braunstein
Top achievements
Rank 1
Harald Braunstein asked on 09 Mar 2009, 02:57 PM
Is it somehow possible to access the container of RadMenuItems ? For example I would like to have all RadMenuItems in some custom control (i.e. scrollviewer or anything else).

3 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 09 Mar 2009, 06:10 PM
Hi Harald Braunstein,

Can you collaborate more on what you want to achieve?
If you want to change the panel in which RadMenuItems are added you can use ItemsPanel property.
Here is sample code demonstrating how to change the ItemsPanel:
<telerik:RadMenuItem Header="File">     
   <telerik:RadMenuItem.ItemsPanel>    
      <ItemsPanelTemplate>    
         <core:RadWrapPanel Orientation="Vertical" Height="400"/>     
      </ItemsPanelTemplate>    
   </telerik:RadMenuItem.ItemsPanel>    
   <telerik:RadMenuItem Header="Open"/>     
   <telerik:RadMenuItem Header="Save"/>     
   <telerik:RadMenuItem Header="Close"/>     
   <telerik:RadMenuItem Header="Exit"/>     
</telerik:RadMenuItem>    
 


Greetings,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Harald Braunstein
Top achievements
Rank 1
answered on 10 Mar 2009, 09:13 AM
Well, thats what I already know. I need to deeply modify the item container to contain also other controls, not just items - for example something like this.
<telerik:RadMenuItem Header="A"
<StackPanel> 
<MyCustomControl/> 
<telerik:RadMenuItem Header="B"
<telerik:RadMenuItem Header="C"
<telerik:RadMenuItem Header="D"
</StackPanel> 
</telerik:RadMenuItem> 
0
Hristo
Telerik team
answered on 12 Mar 2009, 01:41 PM
Hi Harald Braunstein,

To put some static content in all RadMenuItems you can modify the control template and put this controls there. But this is a custom case because I guess you will want different controls for different menuItems. This can be done if you set data object as ItemsSource to RadMenu and specify different DataTemplates using RadMenu.ItemTemplateSelector. Using ItemTemplateSelector you will be able to specify different templates for all menu items.

Let me know if you need more information.

All the best,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Menu
Asked by
Harald Braunstein
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Harald Braunstein
Top achievements
Rank 1
Share this question
or