【发布时间】:2015-09-18 07:40:46
【问题描述】:
我对 Microsoft GitHub 存储库中的 Title'Bar 示例有疑问(https://github.com/JustinXinLiu/FullScreenTitleBarRepo/tree/master/FullScreenTitleBarRepo):在 AddCustomTitleBar 函数中,有一行:
customTitleBar.EnableControlsInTitleBar(areControlsInTitleBar);
EnableControlsInTitleBar 在这里:
public void EnableControlsInTitleBar(bool enable)
{
if (enable)
{
TitleBarControl.Visibility = Visibility.Visible;
// Clicks on the BackgroundElement will be treated as clicks on the title bar.
Window.Current.SetTitleBar(BackgroundElement);
}
else
{
TitleBarControl.Visibility = Visibility.Collapsed;
Window.Current.SetTitleBar(null);
}
}
但如果我不调用函数(EnableControlsInTitleBar),示例仍然可以正常工作
在 Justin XL 样本(https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/TitleBar) 中确实有使用这个:
Window.Current.SetTitleBar(BackgroundElement);
这让我很困惑,希望有人能给我解释一下,谢谢。
【问题讨论】:
标签: c# windows windows-10 win-universal-app uwp