How to set text wrapping for columns?

Oct 10, 2013 at 6:53 AM
Hi,

I've just come across your Extended Data Grid and I think it's great. I have a stupid question though - how do I set it to wrap text if the data in a particular cell extends beyond the width of the cell?

Is there a simple way to set it up so that the text will wrap and the row that the cell belongs to will automatically resize to accomodate the fact that the text appears on multiple lines?

I'm fairly new to this, so apologies if it's a bit of a stupid question!
Coordinator
Oct 10, 2013 at 6:29 PM
Hi ,

As this grid is derived from WPF toolkit datagrid, you can find solution for it internet.

You can use this strategy.

<DataGrid.Columns>               
    <DataGridTextColumn Header="Wrapped & centered" Binding="{Binding field}">
        <DataGridTextColumn.ElementStyle>
             
         </DataGridTextColumn.ElementStyle>
    </DataGridTextColumn>
</DataGrid.Columns>
Source: http://stackoverflow.com/questions/4671836/how-get-a-wpf-datagrid-with-cells-that-wrap-text-instead-of-truncating-it

Regards,
bpoojary


Oct 13, 2013 at 2:24 PM
Hi bpoojary, thanks for the prompt reply!

I did find that solution previously, but initially thought that it wasn't working because the rows were not resizing, so it did not appear that the text was wrapping. I see now that the text is wrapping as expected, and my problem is getting the row to automatically size to the text.

It seems to work fine with the default WPF datagrid, but not with the extended datagrid. There must be a default setting somewhere that I'm missing - I'll keep playing around with it, and thanks again for your help!
Coordinator
Oct 13, 2013 at 6:16 PM
Hi,

I fixed it, You can take latest (Change set 28037).
I had hard coded value of RowHeight in one of the style thats why it was not working properly.
It worked fine for me , try it at your end.

Regards,
bpoojary
Oct 23, 2013 at 11:09 AM
Sorry for the late reply - that did fix the issue, thanks!