how to hide / collapse title bar in a UWP app?

拟墨画扇 提交于 2019-12-04 09:37:20

问题


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


回答1:


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;



来源:https://stackoverflow.com/questions/33440438/how-to-hide-collapse-title-bar-in-a-uwp-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!