This is a migrated thread and some comments may be shown as answers.

Textwrapping in column

1 Answer 115 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ludwig
Top achievements
Rank 1
Ludwig asked on 12 May 2011, 09:30 PM
I have a simple gridview as follows:

<telerikgridview:RadGridView ScrollViewer.HorizontalScrollBarVisibility="Disabled" x:Name="ActivitiesGrid" IsReadOnly="True" AutoGenerateColumns="False" SelectionMode="Extended" ItemsSource="{Binding SelectedPatient.Activities}" ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" ShowColumnHeaders="False" SelectionChanged="ActivitiesGrid_SelectionChanged">
  <telerikgridview:RadGridView.Columns>
      <telerikgridview:GridViewDataColumn DataMemberBinding="{Binding ActivityDate}" Header="{lex:LocText S3.ParametersUE.PatientManagement:UIStrings:PatientDetailsView_GridActivityHeaderDate}" DataFormatString="{}{0:dd/MM/yyyy}" MinWidth="100"/>
      <telerikgridview:GridViewDataColumn DataMemberBinding="{Binding Description}" Header="{lex:LocText S3.ParametersUE.PatientManagement:UIStrings:PatientDetailsView_GridActivityHeaderDescription}" />                                                
  </telerikgridview:RadGridView.Columns> </telerikgridview:RadGridView>

If the text of Description is long, a horizontal scrollbar appears. How can I make sure that no horizontal scrollbar appears, but that the text is wrapped so that it is full visible in the column?

1 Answer, 1 is accepted

Sort by
0
Ludwig
Top achievements
Rank 1
answered on 12 May 2011, 09:54 PM
found a solution, don't know if this is the best way but it works. I just size the column dynamically:

private void ActivitiesGrid_SizeChanged(object sender, SizeChangedEventArgs e)
{
        ActivitiesGrid.Columns[1].Width = ActivitiesGrid.ActualWidth - ActivitiesGrid.Columns[0].ActualWidth - 3;
}

and now the text is wrapped properly.
Tags
GridView
Asked by
Ludwig
Top achievements
Rank 1
Answers by
Ludwig
Top achievements
Rank 1
Share this question
or