Xamarin.Forms | ComponentOne
Controls / FlexGrid / Features / Wordwrap
In This Topic
    Wordwrap
    In This Topic

    FlexGrid's WordWrap property allows a user to display multi-line text in a single cell of the grid. To enable word wrapping in a FlexGrid column, set the value of WordWrap property to true. By default, its value is set to False. The WordWrap property determines whether the grid should automatically break long strings containing multiple words and special characters such as spaces in multiple lines. Multiple line text can be displayed in both fixed and scrollable cells.

    In Code

    C#
    Copy Code
    //to enable word wrap
    grid.Columns[1].WordWrap = true;
    

    In XAML

    C#
    Copy Code
    <c1:GridColumn Binding="Name" Width="Auto" WordWrap="True"/>
    

    To resize the row heights automatically, you can then call the AutoSizeRow and AutoSizeRows methods as illustrated in the code below.

    C#
    Copy Code
    // resize a single row
    grid.AutoSizeRow(1);
    
    // resize all rows
    grid.AutoSizeRows(0, grid.Rows.Count – 1);