I have a UWP app and I want to upgrade it to fluent design system. I have created a new project using Windows Template Studio and my navigation is with Pivot.
Now I want to put acrylic background on the header of the pivot. as mentioned in the design guidelines of uwp it is recommended to use 70 percent acrylic in this scenario.
So I tried to use 70 percent acrylic with following code.
private void MainPivot_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.AcrylicBrush"))
{
MainPivot.Background = Application.Current.Resources["SystemControlAltHighAcrylicWindowBrush"] as AcrylicBrush;
}
}
Where MainPivot is the pivot I am using and this loaded method is loaded event for that pivot.
The problem is that it works only for either Light or Dark Theme (depends which theme was set during last run of the app), but when app is running and I change theme and switch between light or dark themes, it doesn't work well for both themes, for example if I make the theme dark the acrylic color remains white and pivot header text is also white hence creating disturbed UI.
Also the FallBack Color doesn't make sense either, for light theme fallback color is black (which blends in with black text) and same problem occurs in dark theme.
The reason I am doing it from code behind because the min project target of my app is creators update which doesn't have acrylic brush.