Use a DataGridTableStyle object:
' Create new Table Style.
Dim ts As New DataGridTableStyle' Allocate it a mapping namets.MappingName =
"Person" ' Note this is the same name as the Table' Get rid of the default
TableStyleDataGrid1.TableStyles.Clear()' Add this Style to the
CollectionDataGrid1.TableStyles.Add(ts)' Assign New Widths to DataGrid
columns.With DataGrid1.TableStyles("Person") ' Now set the values for this
Style.GridColumnStyles(0).Width = 75 ' First column,
width.GridColumnStyles(1).Width = 25 ' Second
column.GridColumnStyles(2).Width = 75End With
-----Original Message-----
Use a DataGridTableStyle object:
' Create new Table Style.
Dim ts As New DataGridTableStyle' Allocate it a mapping namets.MappingName =
"Person" ' Note this is the same name as the Table' Get rid of the default
TableStyleDataGrid1.TableStyles.Clear()' Add this Style to the
CollectionDataGrid1.TableStyles.Add(ts)' Assign New Widths to DataGrid
columns.With DataGrid1.TableStyles("Person") ' Now set the values for this
Style.GridColumnStyles(0).Width = 75 ' First column,
width.GridColumnStyles(1).Width = 25 ' Second
column.GridColumnStyles(2).Width = 75End With
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.