Hello,
I have a a RibbonView hosted in my MainWiindow. All the RibbonTabs (and the ContextualTabs) are defined in the MainWindow.xaml. The second part in the MainWindow is a RadTabControl that is used for showing all ViewModels (and the corresponding Views).
Every UserControl in the RadTabControl has a corresponding ContextualRibbonTab. The Command of the RibbonButtons inside the ContextualTabs are bound to commands in the SelectedItem of the RadTabControl (Commands defined in the ViewModel). Everything works fine, the only problem is, that everytime a new Tab get's loaded in the RadTabControl, WPF tries to bind all the Commands of all ContextualTabs to the currently SelectedItem in the RadTabControl, which causes a lot of binding errors for those commands that don't exist in the currentyl active viewmodel. Is there a way to prevent WPF from rebinding alle the commands, i all want to bind the Commands of the corresponding ContextualTab.
Here is the definition of my RibbonTabs:
I have a a RibbonView hosted in my MainWiindow. All the RibbonTabs (and the ContextualTabs) are defined in the MainWindow.xaml. The second part in the MainWindow is a RadTabControl that is used for showing all ViewModels (and the corresponding Views).
Every UserControl in the RadTabControl has a corresponding ContextualRibbonTab. The Command of the RibbonButtons inside the ContextualTabs are bound to commands in the SelectedItem of the RadTabControl (Commands defined in the ViewModel). Everything works fine, the only problem is, that everytime a new Tab get's loaded in the RadTabControl, WPF tries to bind all the Commands of all ContextualTabs to the currently SelectedItem in the RadTabControl, which causes a lot of binding errors for those commands that don't exist in the currentyl active viewmodel. Is there a way to prevent WPF from rebinding alle the commands, i all want to bind the Commands of the corresponding ContextualTab.
Here is the definition of my RibbonTabs:
<!--Kontext Tab's-->
<
telerik:RadRibbonView.ContextualGroups
>
<
telerik:RadRibbonContextualGroup
x:Name
=
"uxContextualGroupCustomerOverview"
Header
=
"Kunden"
Color
=
"Goldenrod"
>
<
telerik:RadRibbonContextualGroup.Style
>
<
Style
TargetType
=
"telerik:RadRibbonContextualGroup"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding WorkspaceView.CurrentItem.ContextualTabGroup}"
Value
=
"Kundenübersicht"
>
<
Setter
Property
=
"IsActive"
Value
=
"True"
/>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
</
telerik:RadRibbonContextualGroup.Style
>
</
telerik:RadRibbonContextualGroup
>
<
telerik:RadRibbonContextualGroup
x:Name
=
"uxContextualGroupEvents"
Header
=
"Veranstaltungen"
Color
=
"Orchid"
>
<
telerik:RadRibbonContextualGroup.Style
>
<
Style
TargetType
=
"telerik:RadRibbonContextualGroup"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding WorkspaceView.CurrentItem.ContextualTabGroup}"
Value
=
"Veranstaltungsübersicht"
>
<
Setter
Property
=
"IsActive"
Value
=
"True"
/>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
</
telerik:RadRibbonContextualGroup.Style
>
</
telerik:RadRibbonContextualGroup
>
<
telerik:RadRibbonContextualGroup
x:Name
=
"uxContextualGroupEmployeeOverView"
Header
=
"Mitarbeiter"
Color
=
"IndianRed"
>
<
telerik:RadRibbonContextualGroup.Style
>
<
Style
TargetType
=
"telerik:RadRibbonContextualGroup"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding WorkspaceView.CurrentItem.ContextualTabGroup}"
Value
=
"Mitarbeiterübersicht"
>
<
Setter
Property
=
"IsActive"
Value
=
"True"
/>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
</
telerik:RadRibbonContextualGroup.Style
>
</
telerik:RadRibbonContextualGroup
>
<
telerik:RadRibbonContextualGroup
x:Name
=
"uxContextualGroupReport"
Header
=
"Report"
Color
=
"ForestGreen"
>
<
telerik:RadRibbonContextualGroup.Style
>
<
Style
TargetType
=
"telerik:RadRibbonContextualGroup"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding WorkspaceView.CurrentItem.ContextualTabGroup}"
Value
=
"Bericht"
>
<
Setter
Property
=
"IsActive"
Value
=
"True"
/>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
</
telerik:RadRibbonContextualGroup.Style
>
</
telerik:RadRibbonContextualGroup
>
<
telerik:RadRibbonContextualGroup
x:Name
=
"uxContextualGroupMap"
Header
=
"Karte"
Color
=
"DarkRed"
>
<
telerik:RadRibbonContextualGroup.Style
>
<
Style
TargetType
=
"telerik:RadRibbonContextualGroup"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding WorkspaceView.CurrentItem.ContextualTabGroup}"
Value
=
"Karte"
>
<
Setter
Property
=
"IsActive"
Value
=
"True"
/>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
</
telerik:RadRibbonContextualGroup.Style
>
</
telerik:RadRibbonContextualGroup
>
<
telerik:RadRibbonContextualGroup
x:Name
=
"uxContextualGroupEventRegistrationOverView"
Header
=
"Veranstaltungsanmeldungen"
Color
=
"LightSalmon"
>
<
telerik:RadRibbonContextualGroup.Style
>
<
Style
TargetType
=
"telerik:RadRibbonContextualGroup"
>
<
Style.Triggers
>
<
DataTrigger
Binding
=
"{Binding WorkspaceView.CurrentItem.ContextualTabGroup}"
Value
=
"Veranstaltungsanmeldungsübersicht"
>
<
Setter
Property
=
"IsActive"
Value
=
"True"
/>
</
DataTrigger
>
</
Style.Triggers
>
</
Style
>
</
telerik:RadRibbonContextualGroup.Style
>
</
telerik:RadRibbonContextualGroup
>
</
telerik:RadRibbonView.ContextualGroups
>
<!--Tabs-->
<
telerik:RadRibbonTab
Header
=
"Start"
>
<
telerik:RadRibbonGroup
Header
=
"Gehe zu"
>
<
telerik:RadRibbonButton
Text
=
"Start"
Command
=
"{Binding Path=ShowWorkspaceCommand}"
CommandParameter
=
"StartViewModel"
LargeImage
=
"/SigiNX;component/Images/32/sigi.png"
Size
=
"Large"
/>
<
telerik:RadRibbonButton
Text
=
"Kunden"
Command
=
"{Binding Path=ShowWorkspaceCommand}"
CommandParameter
=
"CustomerOverViewModel"
LargeImage
=
"/SigiNX;component/Images/32/customer.png"
Size
=
"Large"
/>
<
telerik:RadRibbonButton
Text
=
"Mitarbeiter"
Command
=
"{Binding Path=ShowWorkspaceCommand}"
CommandParameter
=
"EmployeeOverViewModel"
LargeImage
=
"/SigiNX;component/Images/32/employee.png"
Size
=
"Large"
/>
<
telerik:RadRibbonButton
Text
=
"Veranstaltungs termine"
Command
=
"{Binding Path=ShowWorkspaceCommand}"
CommandParameter
=
"EventDateOverViewModel"
LargeImage
=
"/SigiNX;component/Images/32/event_date.png"
Size
=
"Large"
/>
<
telerik:RadRibbonButton
Text
=
"Veranstaltungs anmeldungen"
Command
=
"{Binding Path=ShowWorkspaceCommand}"
CommandParameter
=
"EventRegistrationOverViewModel"
LargeImage
=
"/SigiNX;component/Images/32/event_registration.png"
Size
=
"Large"
/>
<
telerik:RadRibbonButton
Text
=
"Karte"
Command
=
"{Binding Path=ShowWorkspaceCommand}"
CommandParameter
=
"MapViewModel"
LargeImage
=
"/SigiNX;component/Images/32/map.png"
Size
=
"Large"
/>
</
telerik:RadRibbonGroup
>
</
telerik:RadRibbonTab
>
<
telerik:RadRibbonTab
Header
=
"Anzeige"
ContextualGroupName
=
"uxContextualGroupCustomerOverview"
>
<
telerik:RadRibbonGroup
Header
=
"Bearbeiten"
>
<
telerik:RadRibbonSplitButton
Text
=
"Neu"
Size
=
"Large"
LargeImage
=
"/SigiNX;component/Images/32/customer_new.png"
Command
=
"{Binding WorkspaceView.CurrentItem.CreateCommand}"
CommandParameter
=
"CustomerDetailViewModel"
DropDownButtonPosition
=
"Bottom"
DropDownIndicatorVisibility
=
"Visible"
>
<
telerik:RadRibbonSplitButton.DropDownContent
>
<
telerik:RadContextMenu
BorderThickness
=
"0"
>
<
telerik:RadMenuItem
Header
=
"neuer Mitarbeiter"
Command
=
"{Binding WorkspaceView.CurrentItem.CreateCommand}"
CommandParameter
=
"EmployeeDetailViewModel"
>
<
telerik:RadMenuItem.Icon
>
<
Image
Source
=
"/SigiNX;component/Images/16/employee_new.png"
/>
</
telerik:RadMenuItem.Icon
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Header
=
"neuer Vertrag"
Command
=
"{Binding WorkspaceView.CurrentItem.CreateCommand}"
CommandParameter
=
""
>
<
telerik:RadMenuItem.Icon
>
<
Image
Source
=
"/SigiNX;component/Images/16/contract_new.png"
/>
</
telerik:RadMenuItem.Icon
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Header
=
"neue Zustimmungserklärung"
Command
=
"{Binding WorkspaceView.CurrentItem.CreateCommand}"
CommandParameter
=
""
>
<
telerik:RadMenuItem.Icon
>
<
Image
Source
=
"/SigiNX;component/Images/16/sign_new.png"
/>
</
telerik:RadMenuItem.Icon
>
</
telerik:RadMenuItem
>
</
telerik:RadContextMenu
>
</
telerik:RadRibbonSplitButton.DropDownContent
>
</
telerik:RadRibbonSplitButton
>
<
StackPanel
>
<
telerik:RadRibbonButton
Text
=
"Bearbeiten"
Command
=
"{Binding WorkspaceView.CurrentItem.EditCommand}"
Size
=
"Medium"
SmallImage
=
"/SigiNX;component/Images/16/edit.png"
/>
</
StackPanel
>
</
telerik:RadRibbonGroup
>
<
telerik:RadRibbonGroup
Header
=
"Anzeige"
>
<
telerik:RadRibbonSplitButton
Text
=
"gruppiern"
DropDownButtonPosition
=
"Bottom"
Size
=
"Large"
LargeImage
=
"/SigiNX;component/Images/32/group_by.png"
>
<
telerik:RadSplitButton.DropDownContent
>
<
telerik:RadContextMenu
BorderThickness
=
"0"
>
<
telerik:RadMenuItem
Header
=
"nach Typ"
Command
=
"{Binding WorkspaceView.CurrentItem.GroupCommand}"
CommandParameter
=
"Typ"
>
<
telerik:RadMenuItem.Icon
>
<
Image
Source
=
"/SigiNX;component/Images/16/employee.png"
/>
</
telerik:RadMenuItem.Icon
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Header
=
"nach Bezirk"
Command
=
"{Binding WorkspaceView.CurrentItem.GroupCommand}"
CommandParameter
=
"Bezirk"
>
<
telerik:RadMenuItem.Icon
>
<
Image
Source
=
"/SigiNX;component/Images/16/contract.png"
/>
</
telerik:RadMenuItem.Icon
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Header
=
"nach Zone"
Command
=
"{Binding WorkspaceView.CurrentItem.GroupCommand}"
CommandParameter
=
"Zone"
>
<
telerik:RadMenuItem.Icon
>
<
Image
Source
=
"/SigiNX;component/Images/16/trainer.png"
/>
</
telerik:RadMenuItem.Icon
>
</
telerik:RadMenuItem
>
</
telerik:RadContextMenu
>
</
telerik:RadSplitButton.DropDownContent
>
</
telerik:RadRibbonSplitButton
>
<
telerik:RadRibbonButton
Text
=
"Bericht"
Command
=
"{Binding WorkspaceView.CurrentItem.ShowReportCommand}"
CommandParameter
=
".\\Reports\\Kundenbericht.mrt"
Size
=
"Large"
SmallImage
=
"/SigiNX;component/Images/32/report.png"
/>
</
telerik:RadRibbonGroup
>
<
telerik:RadRibbonGroup
Header
=
"Gehe zu"
>
<
telerik:RadRibbonButton
Text
=
"Mitarbeiter"
Command
=
"{Binding WorkspaceView.CurrentItem.ShowFilteredWorkspaceCommand}"
CommandParameter
=
"EmployeeOverView"
Size
=
"Large"
LargeImage
=
"/SigiNX;component/Images/32/employee.png"
/>
<
StackPanel
>
<
telerik:RadRibbonButton
Text
=
"Karte"
Command
=
"{Binding WorkspaceView.CurrentItem.ShowFilteredWorkspaceCommand}"
CommandParameter
=
"MapView"
Size
=
"Medium"
SmallImage
=
"/SigiNX;component/Images/16/map.png"
/>
<
telerik:RadRibbonButton
Text
=
"Verträge"
Size
=
"Medium"
SmallImage
=
"/SigiNX;component/Images/16/contract.png"
/>
<
telerik:RadRibbonButton
Text
=
"Produkte"
Size
=
"Medium"
SmallImage
=
"/SigiNX;component/Images/16/product.png"
/>
</
StackPanel
>
<
StackPanel
>
<
telerik:RadRibbonButton
Text
=
"Konto"
Size
=
"Medium"
SmallImage
=
"/SigiNX;component/Images/16/accounting.png"
/>
<
telerik:RadRibbonButton
Text
=
"Veranstaltungen"
Command
=
"{Binding WorkspaceView.CurrentItem.ShowFilteredWorkspaceCommand}"
CommandParameter
=
"EventDateOverView"
Size
=
"Medium"
SmallImage
=
"/SigiNX;component/Images/16/event_date.png"
/>
<
telerik:RadRibbonButton
Text
=
"Zustimmungen"
Size
=
"Medium"
SmallImage
=
"/SigiNX;component/Images/16/sign.png"
/>
</
StackPanel
>
</
telerik:RadRibbonGroup
>
</
telerik:RadRibbonTab
>
<
telerik:RadRibbonTab
Header
=
"Berichte"
ContextualGroupName
=
"uxContextualGroupCustomerOverview"
>
</
telerik:RadRibbonTab
>
...