Where can I intercede in the grid creation process to set all columns to wrap? I tried Grid.Loaded and that had no effect.
This is my code:
foreach (var col inthis.Columns) col.TextWrapping = TextWrapping.Wrap;
Thank you,
Leslie
3 Answers, 1 is accepted
0
Vlad
Telerik team
answered on 01 Oct 2010, 12:36 PM
Hi Leslie,
This setting is for data cells - if you want to apply wrapping for column header you add TextBlock in the Header property and set TextWrapping for this TextBlock. For example:
var c = new GridViewColumn();
c.Header = new TextBlock() { Text = "MyHeader", TextWrapping = System.Windows.TextWrapping.Wrap };
Kind regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
So I tried the following, and it had no effect, it even ignored my widths on the columns. I tried it with and without setting the width on the textblock.
privatevoid CmpDataGrid_Loaded(object sender, RoutedEventArgs e) { if (WrapHeaderText) foreach (var col inthis.Columns) if (col.Header isstring && col.Width.Value > 1) col.Header = new TextBlock() { Text = col.Header.ToString(), TextWrapping = System.Windows.TextWrapping.Wrap, Width = col.Width.Value }; }