How to set the header Background color on a specific MDI child in DocumentContainer ?
In DocumentContainer, set the header’s background color on a specific MDIchild using DocumentMDIHeaderStyle property.
XAML
<Window.Resources> <Style x:Key="headerstyle" TargetType="syncfusion:DocumentHeader"> <Setter Property="Header" Value="syncfusion:DocumentHeader.Header"/> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> <GradientStop Color="#FFD9EDFF" Offset="0"/> <GradientStop Color="#FFC0DEFF" Offset="0.445"/> <GradientStop Color="#FFAFD1F8" Offset="0.53"/> </LinearGradientBrush> </Setter.Value> </Setter> </Style> </Window.Resources> <syncfusion:DocumentContainer x:Name="Doccontainer" Mode="MDI"> <ContentControl x:Name="child1" syncfusion:DocumentContainer.Header="Document1" syncfusion:DocumentContainer.DocumentMDIHeaderStyle="{StaticResource headerstyle}"> </ContentControl> <ContentControl x:Name="child2" syncfusion:DocumentContainer.Header="Document2"> <TextBlock Text="This is a document2"/> </ContentControl> <ContentControl x:Name="child3" syncfusion:DocumentContainer.Header="Document3"/> </syncfusion:DocumentContainer> |
C#
Style style = this.FindResource("headerstyle") as Style; child1.SetValue(DocumentContainer.DocumentMDIHeaderStyleProperty, style); |
The following screenshot displays the setting of the header background color on a specific MDIchild,
Figure 1: Output