Creating a dynamic splitbutton

4 posts, 0 answers
  1. Dan Gros
    Dan Gros avatar
    4 posts
    Member since:
    Jan 2010

    Posted 15 Feb 2011 Link to this post

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

  2. George
    Admin
    George avatar
    1332 posts

    Posted 18 Feb 2011 Link to this post

    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
  3. DevCraft banner
  4. Dan Gros
    Dan Gros avatar
    4 posts
    Member since:
    Jan 2010

    Posted 20 Feb 2011 Link to this post

    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
  5. George
    Admin
    George avatar
    1332 posts

    Posted 23 Feb 2011 Link to this post

    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!
Back to Top