Articles in this section
Category / Section

How to set foreground and background in WPF DockingManager?

1 min read

You can customize the DocumentTabControl of a WPF DockingManager by using the DocumentTabControlStyle.

Here, an example is illustrated to set the foreground and background for the selected Document TabItem by customizing the DocumentTabControlStyle. You can change the selected document foreground and background in DockingManager by TabItemSelectedBackground and TabItemSelectedForegroud property of DocumentTabControl in the DocumentTabControlStyle .

The following code example illustrates the code for setting the foreground color for the selected TabItem using the TabItemSelectedBackground property in the DocumentTabControlStyle.

XAML

//sample  code for setting the background for selected Tabitem using the TabItemSelectedBackground
<Window   x:Class="DockManagerColor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="MainWindow" Height="350" Width="525">
<syncfusion:DockingManager
UseDocumentContainer="True">
//Code used to specify how the DocumentTabControlStyle used to set the TabItemSelectedBackground
<syncfusion:DockingManager.DocumentTabControlStyle>
<Style TargetType="{x:Type syncfusion:DocumentTabControl}">
<Setter Property="TabItemSelectedBackground"  Value="Brown"></Setter>
</Style>
</syncfusion:DockingManager.DocumentTabControlStyle>
<ContentControl
syncfusion:DockingManager.Header="Document 1"
syncfusion:DockingManager.State="Document">
</ContentControl>
<ContentControl
syncfusion:DockingManager.Header="Document2"
syncfusion:DockingManager.State="Document">
</ContentControl>
<ContentControl
syncfusion:DockingManager.Header="Document2"
syncfusion:DockingManager.State="Document">
</ContentControl>
</syncfusion:DockingManager>
</Window>

The following screenshot illustrates the output on how the TabItemSelectedBackground property works.

Figure 1: TabItemSelectedBackground Property

The following code example illustrates the code for setting the foreground color for the selected TabItem using the TabItemSelectedForeground property in the DocumentTabControlStyle.

XAML

//sample  code for setting the background for selected Tabitem using the TabItemSelectedForeground
<Window   x:Class="DockManagerColor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="MainWindow" Height="350" Width="525">
<syncfusion:DockingManager
UseDocumentContainer="True">
//Code used to specify how the DocumentTabControlStyle used to set the TabItemSelectedForeground
<syncfusion:DockingManager.DocumentTabControlStyle>
<Style TargetType="{x:Type syncfusion:DocumentTabControl}">
<Setter Property="TabItemSelectedForeground"  Value="Red"></Setter>
</Style>
</syncfusion:DockingManager.DocumentTabControlStyle>
<ContentControl
syncfusion:DockingManager.Header="Document1"
syncfusion:DockingManager.State="Document">
</ContentControl>
<ContentControl
syncfusion:DockingManager.Header="Document2"
syncfusion:DockingManager.State="Document">
</ContentControl>
</syncfusion:DockingManager>
</Window>

The following screenshot illustrates the output on how the TabItemSelectedForeground is applied for the selected TabItems.

Figure 2: TabItemSelectedForeground applied for the selected TabItems


Conclusion

I hope you enjoyed learning about how to set foreground and background in WPF DockingManager.

 You can refer to our WPF DockingManager feature tour  page to know about its other groundbreaking feature representations. You can also explore  documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied