Wrapping Text on Columns of Rows

Hello!

I currently have a sfdatagrid that holds product information. I would like to allow wrapping of text in certain columns. For example. the user may enter a long description of the product. I would like this cell's height to then expand if the user enters in text that goes beyond the cell's width and to wrap. This would increase the Cells height but also the entire row's height as well. I would like this done completely pragmatically if possible without having to use styles if possible. However, I am open to using any method of getting this implemented. Can someone help me implement this functionality?-

What is currently looks like:

Image_6809_1702650235959

How I would like it to look like:
Image_2191_1702650276869


3 Replies

DD Dhivyabharathi Dakshinamurthy Syncfusion Team December 18, 2023 08:46 AM UTC

Hi Jacob,


Your requirement, "Wrapping Text on Columns of Rows" in SfDataGrid can be achievable. You can set the height of the row based on the content after editing by using the  CurrentCellEndEdit and QueryRowHeight Events.


Please find the below mentioned User Guide Documentation link to update the row height while editing.

UG Link: Row Height Customization in WPF DataGrid control | Syncfusion
 

We hope this helps to achieve your requirement. Please let us know, if need any further assistance.



Regards,

DhivyaBharathi Dakshinamurthy



JA Jacob December 21, 2023 05:44 PM UTC

I tried implementing this inside my application, however 

this.dataGrid.GridColumnSizer.GetAutoRowHeight(e.RowIndex, gridRowResizingOptions, out autoHeight)

Would keep coming back with the autoheight of 0. Do you know why autoheight would continue to show as 0 when this method is ran?



CM Chidanand Murugaiah Syncfusion Team December 22, 2023 01:32 PM UTC

Hi Jacob,


Based on the provided information, we have analyzed the reported scenario. Unfortunately, we are unable to replicate the reported scenario, it works as we expected. We prepared a simple sample to achieve your requirement. Could you please check this sample and let us know. 

  • If possible, could you please replicate the reported scenario in the provided sample.
  • If possible, could you please provide the sample with the reported issue occurs.

Providing this information will help us better understand the issue and work towards finding a solution promptly.


Regards,

Chidanand M.


Attachment: SfDataGrid_Demo4_8_8d14f62f.zip

Loader.
Up arrow icon