在 AppBar 中隐藏省略号 [英] Hiding the ellipsis within an AppBar

查看:40
本文介绍了在 AppBar 中隐藏省略号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当你在 UWP 应用中创建 AppBar 或 CommandBar 时,总会有一个省略号隐藏在控件的旁边,如下所示:

When you create an AppBar or a CommandBar in a UWP app, there's always an ellipsis hiding near the side of the control, like so:

我不想在我的应用程序中使用它,但我在 AppBar 中没有找到任何方法/属性可以帮助我摆脱它.它应该是可能的,因为许多默认的 Windows 10 应用程序都没有它.例如,下面的主菜单栏上没有省略号:

I don't want it in my app but I haven't found any methods/properties within AppBarthat would help me get rid of it. It should be possible, because many of the default Windows 10 apps don't have it. For example, there's no ellipsis on the main menu bar below:

是否可以使用 AppBar 隐藏省略号,或者我是否必须使用 SplitView 或其他控件来实现这一点?

Is it possible to hide the ellipsis using AppBar, or do I have to use a SplitView or some other control to implement this?

推荐答案

首先,尽量不要在新的 UWP 应用中使用 AppBar.

First, try not to use AppBar in your new UWP apps.

通用 Windows 应用程序的 CommandBar 控件已改进为提供 AppBar 功能的超集和更大的灵活性如何在您的应用程序中使用它.您应该将 CommandBar 用于所有新的Windows 10 上的通用 Windows 应用.

The CommandBar control for universal Windows apps has been improved to provide a superset of AppBar functionality and greater flexibility in how you can use it in your app. You should use CommandBar for all new universal Windows apps on Windows 10.

您可以在此处阅读更多相关信息.

You can read more about it here.

CommandBarAppBar 都可以完全样式化和模板化.这使您能够删除不想显示的任何 UI 元素.

Both CommandBar and AppBar can be full styled and templated. This gives you the ability to remove whatever UI elements you don't want to display.

这就是你的做法-

在 Blend 中打开您的页面,右键单击 CommandBar > 编辑模板 > 编辑副本.然后确保您选择在应用程序中定义,因为当前 Blend 中存在一个错误,如果您选择此文档,它将无法生成样式.

Open your page in Blend, right click on CommandBar > Edit Template > Edit a Copy. Then make sure you select Define in Application as currently there's a bug in Blend which will fail to generate the styles if you choose This document.

拥有所有样式后,找到 MoreButton 控件并将其 Visibility 设置为 Collapsed(或者您可以将其删除,但如果你意识到你以后需要它吗?).

Once you have all the styles, find the MoreButton control and set its Visibility to Collapsed (or you can remove it but what if you realise you need it later?).

那么你应该有一个没有省略号的 CommandBar.

Then you should have a CommandBar without the ellipsis.

2017 年更新现在可以在 CommandBarOverflowButtonVisibility 属性中找到省略号按钮的可见性.如上将其设置为 Collapsed 以隐藏它.

Update for 2017 The visibility of the Ellipsis button can now be found in the OverflowButtonVisibility Property of a CommandBar. As above set it to Collapsed to hide it.

这篇关于在 AppBar 中隐藏省略号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆