如何获取Listview的标题高度 [英] How do I get the header height of a Listview

查看:162
本文介绍了如何获取Listview的标题高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何获取ListView的标题高度.

Can somebody tell me how to get the header height of a ListView.

推荐答案

这可能有点棘手,但您可以这样做:

This might be a little bit hacky but you can do:

listView.Items[0].Bounds.Top

仅当列表中只有一项时,此选项才起作用.因此,您可能希望在首次创建列表时临时添加一个并保持高度值.

This will only work if there is only one item in the list. So you might want to temporarily add one when you first create the list and keep the height value.

否则,您始终可以使用:

Else, you can always use:

listView.TopItem.Bounds.Top

随时可以进行测试,但您仍然需要列表中至少有一项.

To make the test at any moment, but you still need at least one item in the list.

这篇关于如何获取Listview的标题高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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