Hi,
I am displaying a datagrid. But I am having an issue when trying to loop through the datagrid columns afterwards as I want to dynamically change the header for each column. The code is telling me that no columns exist, i.e. DataGrid.Columns.Count = 0, even though I can see the columns & data correctly when run on the screen.
So what I do is
Dim ThemedDataGridVal = New DataGrid.ThemedDataGrid
ThemedDataGridVal.ItemsSource = DataTable.DefaultView
I then add to my grid and everything displays OK.
The reason I need to then change the column headers is that the the datatable I bind to uses uniqueids as the column names - this is because I may have duplicate actual names for columns being displayed.
So what I want to do after the datagrid is connected to the datatable is loop through the datagrid columns and change the header explicitly to the actual required name (I am hoping that I can have duplicate header column names in the datagrid).
It seems that by binding the datatable, I do not have access to the columns. the code I am trying is as follows:
For Each column In ThemedDataGridVal.Columns
MsgBox(column.header.tostring)
Next
Grateful for any ideas.
Thanks,
Bret
I am displaying a datagrid. But I am having an issue when trying to loop through the datagrid columns afterwards as I want to dynamically change the header for each column. The code is telling me that no columns exist, i.e. DataGrid.Columns.Count = 0, even though I can see the columns & data correctly when run on the screen.
So what I do is
Dim ThemedDataGridVal = New DataGrid.ThemedDataGrid
ThemedDataGridVal.ItemsSource = DataTable.DefaultView
I then add to my grid and everything displays OK.
The reason I need to then change the column headers is that the the datatable I bind to uses uniqueids as the column names - this is because I may have duplicate actual names for columns being displayed.
So what I want to do after the datagrid is connected to the datatable is loop through the datagrid columns and change the header explicitly to the actual required name (I am hoping that I can have duplicate header column names in the datagrid).
It seems that by binding the datatable, I do not have access to the columns. the code I am trying is as follows:
For Each column In ThemedDataGridVal.Columns
MsgBox(column.header.tostring)
Next
Grateful for any ideas.
Thanks,
Bret