UWP 设计自定义标题栏

时间:2021-01-19 02:05:11

标签: c# uwp titlebar

我在 WPF 中设计了这个标题栏,但在 UWP 中我不知道如何做到这一点。

enter image description here

我看到几个链接,但没有一个不适合我:

  1. UWP quick tip: custom titlebar [ github : BlogTitleBar ]
  2. Title bar customization [微软]
  3. How to add a new button in title bar next the minimize button in UWP? [ stackoverflow ]
  4. Customize Title Bar & Add Full Screen Button in UWP

我想隐藏当前的标题栏并创建一个新的,我觉得这个方法更简单,我有能力做任何改变;在 WPF 中就是这种情况。

1 个答案:

答案 0 :(得分:0)

您将 CoreApplicationViewTitleBar.ExtendViewIntoTitleBar 属性设置为 true,然后使用视图中的元素创建您自己的自定义标题栏,如第二个链接的 docs 中所述。

<块引用>

当您选择完全自定义标题栏时,您应用的客户区将扩展为覆盖整个窗口,包括标题栏区域。您负责整个窗口的绘制和输入处理,除了覆盖在应用画布上的标题按钮。

// using Windows.ApplicationModel.Core;

// Hide default title bar.
var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
coreTitleBar.ExtendViewIntoTitleBar = true;
相关问题