c# - UWP 扩展到标题栏 - 默认标题栏转换后退按钮
问题描述
在我的 UWP 应用程序中,我试图将后退按钮放入标题栏中,我过去曾多次这样做。这一次,我面临的问题是默认标题栏似乎并没有消失,而是悬停在我的按钮上,所以我无法按下它。我尝试创建一个带有边距的自定义标题栏,但这并没有解决它。这是延伸到标题栏...:
var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
coreTitleBar.ExtendViewIntoTitleBar = true;
...和自定义标题栏:
var titleBarGrid = new Grid()
{
Background = new SolidColorBrush(Colors.Transparent),
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Top,
Height = 48,
Margin = new Thickness(50, 0, 150, 0),
};
Window.Current.SetTitleBar(titleBarGrid);
这些是在 App.xaml.cs 中设置的。
如何删除/覆盖默认标题栏?
解决方案
不知何故,我通过移动settitlebar(grid)
上面的InitializeComponent()
. Martin - 如果我不设置颜色,它会使窗口不可拖动,然后除了最小化按钮的默认左侧外,没有什么可拖动的。我制作成标题栏的网格的边距不与我的任何按钮重叠。
推荐阅读
- html - 错误 TS2307:找不到模块“fs”或其相应的类型声明
- python - Python中带有浮点值的索引列表的TypeError
- javascript - grunt-contrib-uglify@0.2.7 需要 grunt@~0.4.0 的对等点,但没有安装。您必须自己安装对等依赖项
- javascript - 将 JS 对象与 div 的中间对齐
- python - 向消息添加 django 格式
- java - 为什么我不能在我的“公共类适配器扩展 PagerAdapter”到 MainActivity2s
- javascript - 在浏览器 Javascript 中显示二进制 PDF
- javascript - 警告:文本内容不匹配。React 中的警告
- ajax - extjs 中的 Ajax 请求触发成功,尽管响应为假
- python - 如何使用数据框中 2 列的值使用字典分配新列