在 Xamarin Forms 中找到我们控件的默认高度 [英] Find our the default height of the controls in Xamarin Forms

查看:17
本文介绍了在 Xamarin Forms 中找到我们控件的默认高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在 Xamarin Forms 中找到控件的默认高度?例如,我们有一个条目,其中 Height &Width 未在 XAML 中提及.

How do we find the default height of a control in Xamarin Forms? Say for example we have an entry for which Height & Width is not mentioned in the XAML.

  • 当它在所有 3 个操作系统上运行时,此条目的高度是多少?
  • XF 使用哪个单位表示高度?
  • 在所有 3 个平台上都会有所不同吗?

推荐答案

您可以使用 VisualElement.Height 获取元素的高度.

关于您的问题:

当它在所有 3 个操作系统上运行时,这个条目的高度是多少?

When this is run on all 3 OS, what's the height of this entry?

由于高度是根据其边界分配的,因此没有控件的默认高度,它只会根据 LayoutOptions 填充其边界

Due to the fact height is allocated depending on its bounds, there is no default height of a control it will just fill its boundes depending on the LayoutOptions

XF 使用哪个单位表示高度?

Which unit does XF uses for height?

我认为他们使用 dpx 虽然我找不到任何支持此的链接,但我会继续搜索

I think they use dpx although I can't find any links to back this but I will keep searching

在所有 3 个平台上都会有所不同吗?

Will it be different on all 3 platforms?

这不仅对于每个操作系统都不同,而且对于每个设备可能都不一样,因为正如我所解释的,高度是根据控件的边界确定的

This will not only be different for every OS this could be different for every device because as I explained the height is determined from the bounds of the control

元素的Height取决于它的边界,就像Xaml适用于WPF

The Height of an element depends on its bounds in the same way Xaml works for WPF

这篇 WPF 文章解释了网格内的高度

This WPF article explains height within grids

这篇关于在 Xamarin Forms 中找到我们控件的默认高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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