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

Creating a dynamic splitbutton

3 Answers 74 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Dan Gros
Top achievements
Rank 1
Dan Gros asked on 15 Feb 2011, 10:32 PM
I need a dynamically bound splitbutton which can nest 2 levels deep.  Is this possible, maybe with a HierarchicalDataTemplate? Currently, we use the RadMenu control for a split button but it's hard coded in the manner shown in the sample below, however, I need it to bind to a collection of items which contain a collection of subitems. The button would look like this:
MenuButton
    Category1
SubCategory1
        SubCategory2
     Category2
SubCategoryA

The resulting click would then notify which SubItem I had clicked:

This is the hardcoded example:
 <StackPanel Grid.Row="0"  Orientation="Horizontal" HorizontalAlignment="Left">
                    <Telerik:RadMenu Grid.Row="0" x:Name="AnalysisTypeMenu" HorizontalAlignment="Left" HorizontalContentAlignment="Left" ClickToOpen="True" Style="{StaticResource OurButtonMenuStyle}">
                        <Telerik:RadMenuItem Name="ButtonName" Header="ButtonCaption" Style="{StaticResource OurMenuItemStyle}">
                            <Telerik:RadMenuItem Header="MenuItem1" >
                         <Telerik:RadMenuItem Header="FirstItemUnder1" Commands:ClickCommands.Command="{Binding AddNewCommand}" Commands:ClickCommands.CommandParameter="A1,A2"/>
                                <Telerik:RadMenuItem Header="SecondItemUnder1" Commands:ClickCommands.Command="{Binding AddNewCommand}" Commands:ClickCommands.CommandParameter="A1,A2" />

3 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 18 Feb 2011, 02:25 PM
Hello, 


Yes, it is possible to bind the RadMenu to a dynamic data using HerarchicalDataTemplate. For more information, please refer to:

I hope this helps.

Best wishes,
George
the Telerik team
0
Dan Gros
Top achievements
Rank 1
answered on 21 Feb 2011, 02:48 AM
This worked great, however, can you provide an example of how I can bind commands to the clicked items? It would also help to pass parameters in those commands
0
George
Telerik team
answered on 23 Feb 2011, 04:52 PM
Hello,

 
I would suggest you to use the RadMenuItem.Command and RadMenuItem.CommandParameter properties. For more information, please refer to our online documentation - http://www.telerik.com/help/silverlight/radmenu-features-commands.html

Greetings,
George
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Menu
Asked by
Dan Gros
Top achievements
Rank 1
Answers by
George
Telerik team
Dan Gros
Top achievements
Rank 1
Share this question
or