如何在 UWP 应用中隐藏/折叠标题栏? [英] how to hide / collapse title bar in a UWP app?
问题描述
有没有办法在 UWP 应用中以某种方式隐藏/折叠/使标题栏暂时不可见(但不是完全禁用)?
我知道可以在标题栏自动折叠之后使应用程序全屏显示,但我需要在可调整大小的桌面窗口中实现它.我也知道你可以自定义标题栏的外观,比如颜色等.
原因:我有一个有很多窗口的应用程序,需要节省屏幕空间并为窗口的客户区留出更多空间.
我阅读了不同的来源,但找不到答案:
- MSDN 文档
具有扩展视图和透明按钮的背景:
ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;coreTitleBar.ExtendViewIntoTitleBar = true;
Is there a way to somehow hide / collapse / make temporarily invisible (but not fully disable) titlebar in a UWP app?
I know that it is possible to make app fullscreen after which title bar automatically collapses, but I need to implement it in a resizable desktop window. I also know that you can customize appearance of titlebar, like color, etc.
Reason: I have an application with a lot of windows and need to save screen space and have more room for client area of windows.
I've read different sources, but couldn't find an answer:
- MSDN docs ApplicationViewTitleBar, CoreApplicationViewTitleBar
- http://blogs.msdn.com/b/eternalcoding/archive/2015/08/20/uwp-take-the-control-of-your-title-bar.aspx
- https://marcominerva.wordpress.com/2015/05/19/easily-manage-the-title-bar-in-windows-10-apps/
For example, there seems to be a solution for the same problem for WPF: How to remove the title bar from a window but keep the border
解决方案Finally, I should say, that, for the purposes of having additional screen real estate (which I needed), it is possible to expand client area to title bar and make background color of 3 buttons (minimize, maximize, close) transparent:
With standard titlebar:
With extended view and transparent buttons' background:
ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar; formattableTitleBar.ButtonBackgroundColor = Colors.Transparent; CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true;
这篇关于如何在 UWP 应用中隐藏/折叠标题栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!