We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Textwrapping

Thread ID:

Created:

Updated:

Platform:

Replies:

150286 Dec 31,2019 01:43 AM UTC Dec 31,2019 09:15 AM UTC WPF 1
loading
Tags: SfDataGrid
Timo
Asked On December 31, 2019 01:43 AM UTC

Hi,

I'm trying to get the Text to get wrapped in a Datagrid.
I've set up a Style:

<Style x:Key="wrappingText" TargetType="syncfusion:GridCell">
            <Setter Property="TextBlock.TextWrapping" Value="Wrap"/>
            <Setter Property="Background" Value="Aqua"/>
</Style>

and applied to in c#

if(e.Column is GridTextColumn)
            {
                e.Column.CellStyle = App.Current.Resources["wrappingText"] as Style;
            }

The Background changed, but the wrapping fails.

Thanks in advance

Timo

Farjana Parveen Ayubb [Syncfusion]
Replied On December 31, 2019 09:15 AM UTC

Hi Timo, 
 
Thank you for using Syncfusion controls. 
 
By default, GridTextColumn having TextWrapping property, so you can set the wrapping for the text using this property. Please refer the below code example 
 
private void SfDataGrid_Loaded(object sender, RoutedEventArgs e) 
{ 
   foreach(var column in sfDataGrid.Columns) 
    { 
        if (column is GridTextColumn) 
            (column as GridTextColumn).TextWrapping = TextWrapping.Wrap; 
    } 
} 
 
 
 
Please let us know if you need any further details on this. 
 
Regards, 
Farjana Parveen A 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon