Xamarin Forms: How to set a list of items as the Expander Child?

前端 未结 2 2092
無奈伤痛
無奈伤痛 2021-01-15 01:07

I am using an Expander for showing units and chapters of a book. I am able to show the units as the Expander.Header, but the chapters under the uni

2条回答
  •  礼貌的吻别
    2021-01-15 01:57

    There are two mistaken in your code .

    1. Incorrect binding path .

    2. Miss BindableLayout.ItemTemplate inside the inner stackLayout .

    Replace your xaml with

    
    
        

    xaml.cs

    //expander child tapping gesture
    public void LoadChapter(object sender, EventArgs args)
    {
        var view = (View)sender;
        var model = view.BindingContext as ContentList;
    
        Debug.WriteLine("title:>>" + model.title);
    }
    

提交回复
热议问题