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

[Solved] header background color of child grid

1 Answer 135 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Farhan
Top achievements
Rank 1
Farhan asked on 03 Sep 2010, 11:04 PM
Actually i am struggling with changing header background color of child grid in hierarchical gridview can any one tell me how i can do? code is in vb.net like

Dim dataControl As GridViewDataControl = DirectCast(sender, GridViewDataControl)
        If dataControl.ParentRow IsNot Nothing Then
            dataControl.CanUserFreezeColumns = False
            dataControl.ShowGroupPanel = False
            dataControl.AutoGenerateColumns = False
            dataControl.RowHeight = 12
            dataControl.FontSize = 10
            
            Dim column As New GridViewDataColumn()

            column = New GridViewDataColumn()
            column.Header = "Id"
            'column.Background = New SolidColorBrush(Color.FromArgb(8, 72, 107, 128))
            'column.HeaderCellStyle 
            column.DataMemberBinding = New System.Windows.Data.Binding("id")
            dataControl.Columns.Add(column)

            

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 06 Sep 2010, 01:49 PM
Hi Farhan,

You can define a Style and add it as a HeaderCellStyle for that column:

Dim s As Style = New System.Windows.Style(GetType(GridViewHeaderCell))
s.Setters.Add(New Setter(BackgroundProperty, "Red"))
column.HeaderCellStyle = s

You might find these help topics useful as well:

Hope this helps.

Regards,
Veselin Vasilev
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
Tags
GridView
Asked by
Farhan
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or