I have a NavigationView
and would like to change the header background color:
I have tried:
- Looking in
generic.xaml
for likely styles to override - Using a HeaderTemplate
Here's my code:
<NavigationView Background="Gray">
<NavigationView.Header>
<Border Background="Green">
<TextBlock Text="Header"/>
</Border>
</NavigationView.Header>
<Border Background="Orange">
<TextBlock Text="Sweet content"/>
</Border>
</NavigationView>
CodePudding user response:
Try to override the NavigationViewContentBackground
theme resource:
<NavigationView Background="Gray">
<NavigationView.Resources>
<SolidColorBrush x:Key="NavigationViewContentBackground" Color="Red" />
</NavigationView.Resources>
<NavigationView.Header>
<Border Background="Green">
<TextBlock Text="Header"/>
</Border>
</NavigationView.Header>
<Border Background="Orange">
<TextBlock Text="Sweet content"/>
</Border>
</NavigationView>