Looking at the documentation for the RibbonView and RibbonButton, I see:
In order to create a command you have to create a static read-only instance ofTelerik.Windows.Controls.RoutedUICommand and then add execute and you can execute event handlers to theTelerik.Windows.Controls.CommandManager class.
Is this seriously the only binding implementation that the RibbonButton supports?! Can't we simply bind the button to an ICommand? Forcing the ugly, complicated implementation of a static read-only RoutedUICommand can't be the only way.
-Greg
In order to create a command you have to create a static read-only instance ofTelerik.Windows.Controls.RoutedUICommand and then add execute and you can execute event handlers to theTelerik.Windows.Controls.CommandManager class.
Is this seriously the only binding implementation that the RibbonButton supports?! Can't we simply bind the button to an ICommand? Forcing the ugly, complicated implementation of a static read-only RoutedUICommand can't be the only way.
-Greg
5 Answers, 1 is accepted
0

Greg
Top achievements
Rank 1
answered on 07 Nov 2011, 08:05 PM
Okay, digging in the Silverlight documentation I see that the RadRibbonButton seemingly does support ICommand, but for some reason I'm getting BindingExpression path errors in my project.
-Greg
-Greg
0

Greg
Top achievements
Rank 1
answered on 07 Nov 2011, 08:47 PM
Okay, so I'm using PRISM and I've placed the RadRibbonView in my Shell.xaml as such:
That error makes total sense because the ShellViewModel doesn't expose a Screen property. Why not? Because that's not the ViewModel that belongs with that View! Somehow the DataContext for the View that defines my RadRibbonTab is getting set to ShellViewModel despite the fact that I set it to something completely different in the View's code behind.
What gives? Is the region adapter for the RadRibbonView stomping on my assigned DataContext perhaps?
Bear in mind that all the rest of the application is working normally. In fact, my ViewModels and Views have only been touched in order to switch from a working implementation of Microsoft's ribbon to Telerik's ribbon. If I change nothing except the XAML and switch back to the Microsoft ribbon then everything works again.
Any ideas?
<
telerik:RadRibbonView
prism:RegionManager.RegionName
=
"Region.Ribbon"
Grid.Row
=
"0"
Title
=
"Graphite"
/>
I have a RadRibbonTab View that looks like this:
<
telerik:RadRibbonTab
x:Class
=
"Company.Graphite.Modules.PartData.Views.AdminRibbonTabView"
xmlns:telerik
=
"clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonView"
mc:Ignorable
=
"d"
Header
=
"Admin"
>
<
telerik:RadRibbonGroup
Header
=
"Actions"
>
<
telerik:RadRibbonButton
LargeImage
=
"pack://application:,,,/Company.Graphite.Resources;component/Icons/32x32/Grey/Standby.png"
Text
=
"Close"
Size
=
"Large"
Command
=
"{Binding Screen.CloseCommand}"
/>
</
telerik:RadRibbonGroup
>
</
telerik:RadRibbonTab
>
My View's code-behind sets the DataContext to my ViewModel. However, when I run the app I see this in the Output window:System.Windows.Data Error: 40 : BindingExpression path error:
'Screen'
property not found on
'object'
''
ShellViewModel
' (HashCode=9898044)'
. BindingExpression:Path=Screen.CloseCommand; DataItem=
'ShellViewModel'
(HashCode=9898044); target element
is
'RadRibbonButton'
(Name=
''
); target property
is
'Command'
(type
'ICommand'
)
That error makes total sense because the ShellViewModel doesn't expose a Screen property. Why not? Because that's not the ViewModel that belongs with that View! Somehow the DataContext for the View that defines my RadRibbonTab is getting set to ShellViewModel despite the fact that I set it to something completely different in the View's code behind.
What gives? Is the region adapter for the RadRibbonView stomping on my assigned DataContext perhaps?
Bear in mind that all the rest of the application is working normally. In fact, my ViewModels and Views have only been touched in order to switch from a working implementation of Microsoft's ribbon to Telerik's ribbon. If I change nothing except the XAML and switch back to the Microsoft ribbon then everything works again.
Any ideas?
0

Greg
Top achievements
Rank 1
answered on 07 Nov 2011, 11:44 PM
I'm at a loss. I created a custom PRISM region adapter and threw in a breakpoint. Everything I can control seems to be working. For example, in the first attached screenshot (radribbonview-01.png) you can see the DataContext for the RadRibbonTab is set as I would expect (CustomersViewModel). However, when the app is running and I have a look with Snoop (radribbonview-02.png) you can see that that DataContext is set to my ShellViewModel via inheritance.
Any ideas? Anybody?
Any ideas? Anybody?
0
Hi Greg,
In the RadRibbonView control there was an issue with the data context propagation, but it was fixed in the Q2 2011 SP1 (version 2011.2.0920) release. This is why I wanted to ask you about the version of the RadControls for WPF that you're using. Can you try your solution with the 2011.2.920 version?
I also attached a sample application where the RadRibbonView is used as a region in a PRISM scenario. If the Q2 2011SP1 release doesn't fix your issues, can you please modify the solution to better illustrate your scenario and we will look into the issue further? Thank you in advance for your cooperation.
Regards,
Tina Stancheva
the Telerik team
In the RadRibbonView control there was an issue with the data context propagation, but it was fixed in the Q2 2011 SP1 (version 2011.2.0920) release. This is why I wanted to ask you about the version of the RadControls for WPF that you're using. Can you try your solution with the 2011.2.920 version?
I also attached a sample application where the RadRibbonView is used as a region in a PRISM scenario. If the Q2 2011SP1 release doesn't fix your issues, can you please modify the solution to better illustrate your scenario and we will look into the issue further? Thank you in advance for your cooperation.
Regards,
Tina Stancheva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0

Greg
Top achievements
Rank 1
answered on 08 Nov 2011, 04:54 PM
Updating to the Q2 2011 SP1 (version 2011.2.0920) release fixed the issue. Thanks!
-Greg
-Greg