gpt4 book ai didi

maui - .NET MAUI 边框和框架之间的区别

转载 作者:行者123 更新时间:2023-12-05 00:43:00 26 4
gpt4 key购买 nike

.NET MAUI 中的 Border 和 Frame 之间的功能区别是什么?

根据 documentation 的边界摘要是

The .NET Multi-platform App UI (.NET MAUI) Border is a container control that draws a border, background, or both, around another control. A Border can only contain one child object. If you want to put a border around multiple objects, wrap them in a container object such as a layout.

还有 Frame 的摘要如下

The .NET Multi-platform App UI (.NET MAUI) Frame class is used to wrap a view or layout with a border that can be configured with color, shadow, and other options. Frames can be used to create borders around controls but can also be used to create more complex UI.

听起来他们都在做同样的事情:在另一个 View 周围绘制边框(无论是布局还是单个控件都无关紧要)。那么为什么会有2种不同的观点呢?我如何决定使用哪一个?

最佳答案

我认为这是由于 .NET MAUI 的历史。 Frame 是 Xamarin.Forms 中的一个控件。我不确定它是否曾经打算成为 控件以在某物周围设置边框,但由于 if 是唯一可以长时间使用阴影和边框的控件,所以很多人们将他们的控件封装在一个Frame中。

但是,现在有了 .NET MAUI,就有机会解决一些历史上的技术债务。这就是为什么引入了更灵活的 Border 的原因。例如,使用 Border 您可以为每个角指定一个单独的角半径。除了纯色之外,您还可以给 Border 一个渐变。

所以从功能的角度来看,Border 有更多的选择,并且可能会比 Frame 更长寿,尽管没有迹象表明 Frame 会去任何地方很快。

这里和那里可能有更多的小差异。基于直觉,我认为 Border 表现更好,但我没有数据支持。

希望这能让它更清楚一点。

关于maui - .NET MAUI 边框和框架之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71738210/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com