FlexGrid WordWrap After Sort

Posted by: hbethel on 27 May 2021, 7:18 am EST

  • Posted 27 May 2021, 7:18 am 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
  • Replied 28 May 2021, 12: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

  • Marked as Answer

    Replied 1 June 2021, 9:32 am 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