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

[Solved] Setting column headers with code behind

1 Answer 109 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.
Denny
Top achievements
Rank 1
Denny asked on 01 Mar 2010, 04:40 PM
Is there a way to set the column headers in code behind? We won't know what they will be ahead of time.

I've tried this but it still displays the data source's name.

Dim

 

HeaderValue As New System.Windows.Controls.TextBlock

 

 

Select Case ProductLevel.SelectedIndex

 

 

Case 0

 

HeaderValue.Text = Labels.SuperCategoryName

 

End Select

 

SalesGridView.Columns(1).Header = HeaderValue

SalesGridView.ItemsSource = SalesData

1 Answer, 1 is accepted

Sort by
0
Denny
Top achievements
Rank 1
answered on 01 Mar 2010, 06:11 PM
I figured it out, although I don't know why.

I have an unbound column and it was throwing off the column index.
Tags
GridView
Asked by
Denny
Top achievements
Rank 1
Answers by
Denny
Top achievements
Rank 1
Share this question
or