有没有 UWP 中等同于 WPF 的 Visibility.Hidden 属性?

huangapple go评论80阅读模式
英文:

Is there an equivalent WPF's Visibility.Hidden property in UWP?

问题

Microsoft的文档中可以看到,在WPF中,Visibility枚举有三个值,分别是VisibleHiddenCollapsed

但在UWP中,缺少了Hidden属性,它可以隐藏控件,但仍然保留了控件所占用的空间。

在UWP中是否有等效的WPF的Visibility.Hidden属性?

英文:

From Microsoft's documentation in WPF the Visibility enum has three values, Visible, Hidden, Collapsed.

UWP is missing the Hidden property, which hides a control, but the space for that control is reserved.

Is there an equivalent WPF's Visibility.Hidden property in UWP?

答案1

得分: 0

尝试使用 IsVisible 属性?
另一个解决方案是使用 Opacity 属性。

英文:

Try to use IsVisible property?
Another solution is to use an Opacity property.

答案2

得分: 0

在 UWP 中,没有像你在 WPF 中所做的直接隐藏功能。一种可能的方法是使用 UIElement.Opacity 属性。您可以将 Opacity 设置为 0。

但请记住,控件仍然能够响应用户,因为它并没有真正隐藏。因此,您还需要将 IsEnabled 属性设置为 false

英文:

In UWP, there is no direct hidden function like what you did in WPF. A possible way is to use the UIElement.Opacity Property. You could set the Opacity as 0.

But remember that the control is still able to response to the user since it is not really hiding. So you need to set the IsEnabled property to false as well.

huangapple
  • 本文由 发表于 2023年5月22日 05:29:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/76302003.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定