You can access the TabItems in the WPF Content Window and Detail code behind to set the properties based on business rules.
Here is sample code that sets the background color of a tab to yellow for a specific module number.
Here is what the code looks like in the Content Window code behind if you want to set the color for a sub module tab that shows in the preview pane.
Note: This code assumes you are using the Docking Tabs (Dragablz) and therefore uses the AB_DockingSubBrowserTabItem class. If you are not using Docking Tabs, then this class should be changed to AB_SubBrowserTabItem.
public override void am_SubBrowsersCreated(ObservableCollection<AB_ITabItem> subBrowserTabs) { base.am_SubBrowsersCreated(subBrowserTabs); foreach (var tabItem in subBrowserTabs) { if (tabItem is AB_DockingSubBrowserTabItem subBrowserTabItem) { if (subBrowserTabItem.ap_SubBrowserModule.ModuleNumber == 6) { subBrowserTabItem.Background = System.Windows.Media.Brushes.Yellow; } } } }
Here is what the code looks like in the Detail code behind if you want to set the color for a sub module tab.
Note: This code assumes you are using the Docking Tabs (Dragablz) and therefore uses the AB_DockingSubBrowserTabItem class. If you are not using Docking Tabs, then this class should be changed to AB_SubBrowserTabItem.
protected override void am_OnDataLoaded() { base.am_OnDataLoaded(); foreach (var tabItem in ap_MainTabControl.ap_TabItems) { if (tabItem is AB_DockingSubBrowserTabItem subBrowserTabItem) { if (subBrowserTabItem.ap_SubBrowserModule.ModuleNumber == 6) { subBrowserTabItem.Background = System.Windows.Media.Brushes.Yellow; } } } // Current Loaded Data Entity //CustomersEntity currentEntity = ap_CurrentEntity as CustomersEntity; }
If you are changing the sub module tab properties in both the Content Window and Detail, then I would suggest to create a method in the ViewModule that receives the SubBrowserTabItem from these code behind methods to set the properties in order to eliminate the duplication of business logic code.