[英]ListView as Grouped in Xamarin.Forms
I am trying to implement Expandable List View in Xamarin.Forms , Since there is not inbuilt control, I am using simple List View and using it as Grouped. 我试图在Xamarin.Forms中实现Expandable List View ,因为没有内置控件,所以我使用简单的List View并将其作为Grouped使用。 But I am not able find control of Header Tap event .
但是我找不到Header Tap事件的控件。
Is there such a tap event ? 有这样的点击事件吗?
Other possibilities of making Expandable List View in Forms ? 在表单中制作可扩展列表视图的其他可能性?
I have tried below code by using GestureRecognizer but tapping is not being captured. 我通过使用GestureRecognizer尝试了以下代码,但未捕获点击。
lstView : List View with header as grouped. lstView:列出标题分组的列表视图。
Content = new StackLayout {
Children = {lstView}
};
var tap = new TapGestureRecognizer ();
Content.GestureRecognizers.Add (tap);
tap.Tapped += (object sender, EventArgs e) =>
{
var x = e;
};
The group-item has no built in Tap-event. 该群组项目没有内置的Tap-Event。 The only way you can achive this, is by creating your own control for your group-template.
达到此目的的唯一方法是为组模板创建自己的控件。
In this custom control you can add a GestureRecognizer for tap Events. 在此自定义控件中,您可以为点击事件添加GestureRecognizer。 You can also implement a property on which you can bind to (from your XAML).
您还可以实现一个属性,您可以在该属性上进行绑定(从XAML)。 I can't give you a code-example, because I don't tried it yet (sorry for that).
我不能给你一个代码示例,因为我还没有尝试过(很抱歉)。
But with the infos here , you should be able to do this. 但是有了这里的信息 ,您应该可以做到这一点。 I also found a thread in the Xamarin Forum , which describes the Problem you describe here (no soulition so far, but the infos maybe bring you to the right direction).
我还在Xamarin论坛中找到了一个线程,该线程描述了您在此处描述的问题(到目前为止尚无灵魂,但相关信息可能会将您带向正确的方向)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.