Xamarin.Forms:如何在单击或单击后将listview的行从全屏扩展到整个屏幕? [英] Xamarin.Forms: How to expand row from listview over full screen after tap or click?

查看:220
本文介绍了Xamarin.Forms:如何在单击或单击后将listview的行从全屏扩展到整个屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个单元格模板,它们出现在 ListView 中.单击或点击一个单元格后,加载第二个 expanded (调整大小)模板,该模板更长,并显示更多信息. 问题是我希望第二个模板在整个屏幕上扩展和扩展(从工具栏到底部),而不仅仅是模板的内容. 十分清楚,我不想打开新窗口(Navigation.PushAsync),而是以全屏方式扩展整个内容. 现在,我有一种方法可以在单击后固定扩展单元格的高度,但这不是我想要的,因为每个移动设备都不同,并且分辨率不同.

I have two cell templates that appears in ListView. After clicking or taping on a cell, loading the second expanded (resized) template which is longer and shows more information. Problem is that I would like second template to expand and extend over the entire screen (from the toolbar to the bottom), not only as much as the content of template. To be perfectly clear, I do not want to open up a new window (Navigation.PushAsync), but to expand whole content in full screen. For now I have a way to fix the height of the extended cell after clicking, but that's not what I want, because every mobile device is different and has a different resolution.

有什么简单的方法可以做到这一点,还是我必须使用一些Nuget?

Is there any easy way to do this, or I have to use some Nuget?

谢谢!

Thanks in advance!

推荐答案

对于列表视图单元格,您可以使用网格.然后将宽度和高度与列定义绑定在一起.如何做到这一点,您可以在互联网上找到.您可以在特定于平台的项目中获得的屏幕宽度和高度.在android宽度上,您可以像这样:

For list view cell you could use a grid. Then binding width and height with a column definition. How to do it you can find on the internet. Screen width and height you can get in platform specific project. On android width you can get like that:

App.ScreenWidth = ( int )( Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density );

与高度相似.

这篇关于Xamarin.Forms:如何在单击或单击后将listview的行从全屏扩展到整个屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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