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

HeaderRowStyle for telerik gridview

3 Answers 185 Views
GridView
This is a migrated thread and some comments may be shown as answers.
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

Sort by
0
Kalin Milanov
Telerik team
answered on 30 Mar 2010, 01:05 PM
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:
<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
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
                            });
Tags
GridView
Asked by
Mahesh Bhat
Top achievements
Rank 1
Answers by
Kalin Milanov
Telerik team
Kevin Happe
Top achievements
Rank 1
Share this question
or