5 Answers, 1 is accepted
You may take a look at this article for a reference.
Maya
the Telerik team
You may define an implicit style targeting TextBlock as follows:
<
Window.Resources
>
<
Style
TargetType
=
"TextBlock"
>
<
Setter
Property
=
"TextWrapping"
Value
=
"Wrap"
/>
</
Style
>
</
Window.Resources
>
Thus the TextWrapping setting will be applied to all your columns without the need of explicitly setting it.
Regards,
Maya
the Telerik team
Maya -
How would you accomplish this is code-behind?
here is what I tried:
Dim col As GridViewBoundColumnBase
col = New GridViewDataColumn()
With col
.Name = "AFEYear"
.DataMemberBinding = New Binding("AFEYear")
.TextAlignment = TextAlignment.Left
.Width = 50
.IsReadOnly = True
.Header.textblock.text = "AFE Year" 'Error here
.Header.textblock.textwrapping = "Wrap" 'Error here
End With
.Columns.Add(col)
"Textblock" is not a member of Header.
Do you have an example of the right way to manipulate the column header textblock in code?
Please note, that for achieving this you need to instantiate the TextBlock by yourself, as in the code snippet below:
Dim
column
As
New
GridViewDataColumn()
With
{ _
Key .DataMemberBinding =
New
Binding(
"Name"
), _
Key .Width = 80 _
}
Dim
tb
As
New
TextBlock()
tb.Text =
"LOOOOOOOOOOOOOOOOOOONG"
tb.TextWrapping = TextWrapping.Wrap
column.Header = tb
Me
.clubsGrid.Columns.Add(column)
I hope this makes sense.
Best Regards,
Stefan
Telerik
See What's Next in App Development. Register for TelerikNEXT.