Mahesh Bhat
Top achievements
Rank 1
Mahesh Bhat
asked on 29 Mar 2010, 02:12 PM
Anyone could help me to apply style for HeaderRowStyle for GridViewHeaderRow with Header Text wrapping.
3 Answers, 1 is accepted
0
Hello Mahesh Bhat,
What you can do is use the Header property of the column, define a text block in it and set it to wrap. The XAML for this should look something similar to:
Let me know how this goes.
Best wishes,
Kalin Milanov
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.
What you can do is use the Header property of the column, define a text block in it and set it to wrap. The XAML for this should look something similar to:
<
gridView:RadGridView
ItemsSource
=
"{Binding Collection}"
>
<
gridView:RadGridView.Columns
>
<
gridView:GridViewDataColumn
DataMemberBinding
=
"{Binding Property1}"
>
<
gridView:GridViewDataColumn.Header
>
<
TextBlock
TextWrapping
=
"Wrap"
Text
=
"Wrapped column header text"
/>
</
gridView:GridViewDataColumn.Header
>
</
gridView:GridViewDataColumn
>
</
gridView:RadGridView.Columns
>
</
gridView:RadGridView
>
Let me know how this goes.
Best wishes,
Kalin Milanov
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.
0
Kevin Happe
Top achievements
Rank 1
answered on 07 Apr 2010, 08:40 PM
I have the same basic problem. But I can not specify the columns in xaml. The list of columns are defined in a service and the app loads the columns at runtime.
So what is preferred way of text wrapping a column header in code? It is ok to specify a style that would active on all column headers.
Thanks
Kevin
So what is preferred way of text wrapping a column header in code? It is ok to specify a style that would active on all column headers.
Thanks
Kevin
0
Kevin Happe
Top achievements
Rank 1
answered on 07 Apr 2010, 09:09 PM
I found my answer in http://www.telerik.com/community/forums/silverlight/gridview/wrap-header-text.aspx
I used a AlignmentContentPresenter.
Telerik.Windows.Controls.GridView.AlignmentContentPresenter alg = new Telerik.Windows.Controls.GridView.AlignmentContentPresenter();
alg.TextWrapping = TextWrapping.Wrap;
alg.Content = so.Description;
GridViewDataColumns.Add(new GridViewDataColumn()
{
Header = alg,
IsReadOnly = false,
MaxWidth=100,
DataMemberBinding = yada yada yada
});
I used a AlignmentContentPresenter.
Telerik.Windows.Controls.GridView.AlignmentContentPresenter alg = new Telerik.Windows.Controls.GridView.AlignmentContentPresenter();
alg.TextWrapping = TextWrapping.Wrap;
alg.Content = so.Description;
GridViewDataColumns.Add(new GridViewDataColumn()
{
Header = alg,
IsReadOnly = false,
MaxWidth=100,
DataMemberBinding = yada yada yada
});