简体   繁体   中英

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. But I am not able find control of Header Tap event .

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.

lstView : List View with header as grouped.

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. 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. You can also implement a property on which you can bind to (from your 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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM