FlexGrid WordWrap After Sort

Posted by: hbethel on 27 May 2021, 4:18 pm EST

    • Post Options:
    • Link

    Posted 27 May 2021, 4:18 pm EST

    Hello,

    I have a FlexGrid in a Xamarin Forms project for Android and need to set word wrap on a couple of columns. The grid loads as expected using the AutoSizeRows after binding the ItemSource. However, if I tap on one of the column headers to sort, the grid returns with the default row height. I’m trying to find a ‘sort changed’ event, so I can apply the AutoSizeRows.

    I found an older forum post that shows how to create an event from the grid’s CollectionView, but that seems outdated (I’m using 4.3.20193.437). I also tried similar using the grid’s DataCollection object, but none of my attempts catch the event.

    Any suggestions?

    Thanks!

    Herb Bethel

  • Posted 28 May 2021, 9:37 am EST

    You can attach the SortChanged event in the DataCollection of the FlexGrid and capture it accordingly to apply AutoSizeRows.

      
           grid.DataCollection.AttachSortChanged(SortChanged);
    
            private void SortChanged(object sender, EventArgs e)
            {
                // apply auto size rows
            }
    
    

    Please let me know if you need any other help.

    Thanks

  • Posted 1 June 2021, 6:32 pm EST

    Thank you Abhishek! That is working perfectly!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels