Wrap text in GridTreeControl cells


Hi.

How do you implement the equivalent of TextWrapping="Wrap" and/or set the row height to expand to the content?

1 Reply

SP Sowndaiyan Paulpandi Syncfusion Team January 25, 2016 12:45 PM UTC

Hi Murad,

Thanks for contacting Syncfusion Support.

We have analyzed your queries and please find the responses for your queries below,

Query [ Set Text Wrapping ]

You can achieve the TextWrapping by customizing TextWrapping property in a GridTree column and  increasing Row Height of a particular row like the below code example,

XAML

<syncfusion:GridTreeColumn HeaderText="Department" MappingName="Department" >

                <syncfusion:GridTreeColumn.StyleInfo>

                    <syncfusion:GridDataStyleInfo TextWrapping="Wrap" />

                </syncfusion:GridTreeColumn.StyleInfo>

</syncfusion:GridTreeColumn>


C#


 treeGrid.Loaded += treeGrid_Loaded;


 void treeGrid_Loaded(object sender, RoutedEventArgs e)
  {

treeGrid.Model.RowHeights[11] = 50;

treeGrid.Model.RowHeights[6] = 50;

treeGrid.Model.RowHeights[12] = 50;

treeGrid.Model.RowHeights[13] = 50;

treeGrid.Model.RowHeights[14] = 50;

  }


Query [ Row height based upon the content ]

You can resizing the Rows by using ResizeRowsToFit method. Please find the following code
example to illustrate this,

C#


void
 treeGrid_Loaded(object sender, RoutedEventArgs e)

        {

            treeGrid.InternalGrid.Model.ResizeRowsToFit(GridRangeInfo.Table(), GridResizeToFitOptions.NoShrinkSize);

        }


And you can change the default row height of the GridTreeControl like the below code example,

C#

this
.gridtreecontrol.ModelLoaded += new EventHandler(gridtreecontrol_ModelLoaded);

void gridtreecontrol_ModelLoaded(object sender, EventArgs e)
  {            
    this.gridtreecontrol.Model.RowHeights.DefaultLineSize = 65;
  }



Regards,

Sowndaiyan

Loader.
Up arrow icon