简体   繁体   English

Window 带圆角 WinUI 3

[英]Window with rounded corners WinUI 3

I need the rounded corners in my UWP(WinUI 2) application, but how I understand, it is impossible.我的 UWP(WinUI 2) 应用程序需要圆角,但据我所知,这是不可能的。 So I found github issues, that says what WinUI 3 allows you to create a rounded corners on windows(like in new windows search).所以我发现了 github 问题,这说明 WinUI 3 允许您在 Windows 上创建圆角(如在新的 windows 搜索中)。 Maybe someone can help me with this?也许有人可以帮我解决这个问题?

On controls that support it, all you need to do is set the CornerRadius property.在支持它的控件上,您需要做的就是设置CornerRadius属性。 How to use styles to set this throughout your application is explained in here: https://docs.microsoft.com/en-us/windows/uwp/design/style/rounded-corner如何在整个应用程序中使用 styles 进行设置在此处进行了说明: https://docs.microsoft.com/en-us/windows/uwp/design/style/rounded-corner

How to set this on individual controls specifically is documented here: Control.CornerRadius Property此处记录了如何在单个控件上进行设置: Control.CornerRadius 属性

<Button Content="Button" 
        CornerRadius="15" />
<Border BorderThickness="5"
        BorderBrush="Black"
        CornerRadius="15" />

You can easily see this in action in Xaml Studio您可以在Xaml Studio中轻松看到这一点

XamlStudio 角半径演示

If you are asking if setting this property on a Page is directly supported, I think the answer is not yet .如果您问是否直接支持在 Page 上设置此属性,我认为答案还没有 I have not seen any documentation to suggest that it is.我没有看到任何文件表明它是。
See: Creating chromeless, non-rectangular Windows from UWP or Is it possible to create a borderless UWP application?请参阅: 从 UWP 创建无边框、非矩形 Windows是否可以创建无边框 UWP 应用程序? for possible workarounds.可能的解决方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM