【发布时间】:2019-01-11 07:32:24
【问题描述】:
如何仅在 UWP 中将丙烯酸材料应用于TitleBar(就像 Microsoft Edge)。在像枢轴这样的场景中。您使用将视图扩展到标题栏。但是如果它只是一个普通的单页应用,你想把标题栏做成亚克力呢
【问题讨论】:
-
那么有人知道吗?
标签: xaml uwp titlebar fluent-design acrylic-material
如何仅在 UWP 中将丙烯酸材料应用于TitleBar(就像 Microsoft Edge)。在像枢轴这样的场景中。您使用将视图扩展到标题栏。但是如果它只是一个普通的单页应用,你想把标题栏做成亚克力呢
【问题讨论】:
标签: xaml uwp titlebar fluent-design acrylic-material
您使用将视图扩展到标题栏。但是如果它只是一个普通的单页应用,你想把标题栏做成亚克力呢
你的理解是正确的。标题栏亚克力,只适用于单页。对于 Edge 设计,它将 TitleBar ButtonBackgroundColor,ButtonInactiveBackgroundColor 设置为透明。并将 ExtendViewIntoTitleBar 属性设置为 true 以将您的内容扩展到 TitleBar。然后在底部区域做一个等高的亚克力元素。
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"/>
【讨论】:
TitleBar.BackgroundColor,如果您确实需要此功能,请随时在UserVoice 上询问此功能。如果答案有帮助,请考虑接受。