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?
7 Answers, 1 is accepted
0
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
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
0
IBST
Top achievements
Rank 1
answered on 21 Mar 2011, 08:04 PM
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
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
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
0
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
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
0
reg
Top achievements
Rank 1
answered on 07 Apr 2011, 06:28 PM
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
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
0
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
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
0
Fernando
Top achievements
Rank 1
answered on 20 Oct 2011, 07:19 PM
Hi Dani...
you can to send this sample in VB?
Thanks
Roger
you can to send this sample in VB?
Thanks
Roger
0
Hello Diego,
Please, find attached the same project in VB.
I hope it helps.
Regards,
Dani
the Telerik team
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 >>