Search code examples
.netwpfavalondock

How do I give one AvalonDock tab item a specific color


I want to give one AvalonDock tab item a different color.

I've tried editing the theme and I've tried to find a property on the DockManager that might expose the TabItems but to no avail.


Solution

  • I think you want to edit the LayoutDocumentTabItem or LayoutAnchorableTabItem style. You can get the original styles from the repository: wpftoolkit/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Themes/generic.xaml

    Just modify them. To change the color of a single particular tab you have to trigger on the appropriate property of your view model. You get access to your ViewModel when in scope of those styles by following this data path in your bindings:

    Path=LayoutItem.Model.(xcad:LayoutDocument.Content).(viewModels:YourViewModel.Property)
    

    Good luck.