Microsoft-ui-xaml: 问题:如何删除按钮和文本框的默认圆角?

创建于 2019-11-17  ·  3评论  ·  资料来源: microsoft/microsoft-ui-xaml

升级到最新的 WinUI 库后,按钮和文本框具有圆角。 但我想要以前的尖角。
手动将所有控件的 CornerRadius 设置为 0 是一种痛苦。 是否有ThemeResource可以覆盖以将按钮和文本框的默认角半径设置为 0?

question

所有3条评论

@MuziburRahman有一个可以使用的全局控制角半径主题资源: ControlCornerRadius

例子:

<Page.Resources>
     <CornerRadius x:Key="ControlCornerRadius">0</CornerRadius>
</Page.Resources>
````

This sets the corner radius for every control on that page to 0 (excluding overlay controls such as Popup and Flyout). If you only want to change the control corner radius for select controls, I'm afraid you currently have to use styles to achieve this. 

If you also want to restore the previous border thickness, you have per-control resources to achieve this:


0

```

您会注意到我在这里使用了页面级作用域,而不是应用程序级作用域。 当使用后一个范围级别定义时,有一个已知错误会阻止应用这些资源覆盖。

要查看的其他资源:

@Felix-Dev 非常感谢。 :D

正如@Felix-Dev 提到的,在应用程序资源中设置此值存在一个未解决的问题。 但是,也许这个问题得到了部分解决,因为我能够通过添加以下内容来删除拐角半径

<CornerRadius x:Key="ControlCornerRadius">0,0,0,0</CornerRadius>

到应用程序资源。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

jtorjo picture jtorjo  ·  108评论

sonnemaf picture sonnemaf  ·  185评论

sapallie picture sapallie  ·  110评论

stmoy picture stmoy  ·  64评论

jesbis picture jesbis  ·  103评论