1

How to make apply an acrylic material to the TitleBar only in UWP (Just like Microsoft Edge). In scenarios like Pivots. You use extend the view to the title bar. But what If it's just an ordinary Single page app and you want to make the title bar acrylic

Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
Adham Ali
  • 81
  • 8

1 Answers1

1

You use extend the view to the title bar. But what If it's just an ordinary Single page app and you want to make the title bar acrylic

Your understanding is correct. For title bar acrylic, it is only suitable for single page. For Edge design, it set TitleBar ButtonBackgroundColor,ButtonInactiveBackgroundColor as transparent. And set ExtendViewIntoTitleBar property true for extending your content into TitleBar. Then make a same height acrylic element place the bottom area.

private void ExtendAcrylicIntoTitleBar()
{
    CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
    CoreApplication.GetCurrentView().TitleBar.LayoutMetricsChanged += (s,e) => {
       Header.Height = s.Height;
   };

    ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
    titleBar.ButtonBackgroundColor = Colors.Transparent;
    titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
}

<Rectangle Name="Header"
Stretch="UniformToFill" 
Fill="{ThemeResource SystemControlChromeHighAcrylicWindowMediumBrush}" 
VerticalAlignment="Top"/>

enter image description here

Nico Zhu
  • 32,367
  • 2
  • 15
  • 36
  • But the problem is when i extend my view into the title bar. I need to set top margins. So that the elements at the top become clickable. I thought that it would be great if some properties such aspplicationView.GetForCurrentView().TitleBar.BackgroundColor could accept a Brush instead of a Color – Adham Ali Aug 07 '18 at 06:36
  • Hi @AdhamAli But it is not support that set brush to `TitleBar.BackgroundColor`, if you do want this feature, please feel free to ask for this feature on [**UserVoice**](https://wpdev.uservoice.com/forums/110705-universal-windows-platform?query=pin%20secondary%20tile%20without%20user%20consent). And if the answer is helpful please consider accept it. – Nico Zhu Aug 07 '18 at 06:44