Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Menu > RadMenu Command in Customization example

Not answered RadMenu Command in Customization example

Feed from this thread
  • IBST avatar

    Posted on Mar 20, 2011 (permalink)

    I’m trying to implement the radMenu like the Customization example (http://demos.telerik.com/silverlight/#Menu/Customization)

    The exemple does’t show how do we bind the command of the links or special links in the ViewModel. I try to look in your foruns and didn’t get any information about that.

    Can you help me on that?

    Reply

  • Dani Dani admin's avatar

    Posted on Mar 21, 2011 (permalink)

    Hi Paulo,

    You can use Commands in your ViewModel in order to make the links fully functional. Use the DelegateCommand class in Telerik.Windows.Controls aseembly to create a custom command that accepts the title of the link as a command parameter and execute the needed redirection in the command itself.
    The FirstLook example of RadContextMenu uses similar approach to execute some actions via Commands.

    I hope this helps.


    Kind regards,
    Dani
    the Telerik team

    Reply

  • IBST avatar

    Posted on Mar 21, 2011 (permalink)

    Hello,

    I'm sorry, but I'm in the dark here and did not undestand your advise.

    How can I use the DelegateCommand here? That's the main problem...

    I checked the example that you talk about and he use the radMenuClick event in the Code-Behind and then I can send to the ViewModel. The headers are using Localization and can in any language, that's why I can't use this way.

    I try to create a DelegateCommand in the MenuItemViewModel

    public

     

     

    DelegateCommand OnClick { get; set; }
    and in the XAML do this

    <

     

     

    local:MenuItemViewModel Content="List of clients" Type="SpecialLink" OnClick="{Binding ClientListCommand}" />

     


    With this I get an error
    Object of type 'System.Windows.Data.Binding' cannot be converted to type 'Telerik.Windows.Controls.DelegateCommand'.

    Is there a way to do this!?!??!


    regards
    Paulo Aboim Pinto
    project: bizSimplex.com

    Reply

  • Dani Dani admin's avatar

    Posted on Mar 22, 2011 (permalink)

    Hi Paulo,

    Attached is a very basic sample illustrating how you can use the DelegateCommand with a basic RadMenu.
     
    Additionally, if your items are localized , you could use one more property in your ViewModel that will provide something similar to an id. You can then pass the value of that property as a command parameter, so that the corresponding command executed method will be able execute any action you need using only that id and regardless of the localization.

    Regards,
    Dani
    the Telerik team

    Reply

  • reg avatar

    Posted on Apr 7, 2011 (permalink)

    Hi Dani,

    Any chance you could show a sample of how to set the command bindings on the templated RadMenuItems in the example highlighted. I am afraid I cant see how this can be done from the link you posted, as the commands are set on actual menu items in that first look example. Whereas the original question was setting commands against menu items that are created from template items using the ItemsSource binding.

    Thanks

    Reply

  • Dani Dani admin's avatar

    Posted on Apr 12, 2011 (permalink)

    Hi Paulo,

    Attached is a sample duplicate of the RadMenu Customization example with Commands. When your items are loaded via the ItemsSource, you need the following: an additional ICommand property in your view model and an additional ContainerBinding for this property in the item template of RadMenu.

    Search for the word "NOTE" to spot the key locations where changes are made.

    I hope this helps.


    Greetings,
    Dani
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Attached files

    Reply

  • DIEGO avatar

    Posted on Oct 20, 2011 (permalink)

    Hi Dani...
    you can to send this sample in VB?

    Thanks

    Roger

    Reply

  • Dani Dani admin's avatar

    Posted on Oct 25, 2011 (permalink)

    Hello Diego,

    Please, find attached the same project in VB.

    I hope it helps.

    Regards,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
    Attached files

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > Menu > RadMenu Command in Customization example
Related resources for "RadMenu Command in Customization example"

Silverlight Menu Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]