How to Set ListView Cell height Automatically

SwagatikaSwagatika Member ✭✭✭

I Have Designed a accordion view ,When i will expand listview that time Listview Items are displaying after that white space is coming.How to solve this Issue.Any suggestion Please?

Answers

  • JarvanJarvan Member, Xamarin Team Xamurai
    edited October 2019

    Did you set HasUnevenRows to true?

    <StackLayout>
        <controls:CustomListView 
            ItemsSource = "{Binding Musics}"
            HasUnevenRows = "true">
            ...
        </controls:CustomListView >
    </StackLayout>
    
  • SwagatikaSwagatika Member ✭✭✭

    @Jarvan said:
    Did you set HasUnevenRows to true?

    <StackLayout>
        <controls:CustomListView 
            ItemsSource = "{Binding Musics}"
            HasUnevenRows = "true">
            ...
        </controls:CustomListView >
    </StackLayout>
    

    i have used HasUnevenRows="True".But still cells are not displaying properly.How to set cells based on screen size. using MVVM.i have wrote code like this
    private int columncount;

        public int Columncount
        {
    
            get {
                if (Device.RuntimePlatform == Device.UWP) 
                {
                    return 2;
                }
                else
                {
                    return 2;
                }
    
            }
        }
    
  • JarvanJarvan Member, Xamarin Team Xamurai

    Here is a tutorial about Expandable ListView With MVVM Pattern, you can refer to:
    https://www.c-sharpcorner.com/article/xamarin-forms-expandable-listview-with-a-sub-listview-mvvm-pattern/

Sign In or Register to comment.