My DataGridTableStyle will absolutely not set the styles whether I set them with the Properties page or in code.
Whether I set the TableStyles or not it displays the same way -- all the columns are aligned to the left and they are all the same width -- no matter how or where I set them.
Here's where I tried setting them in code:
The data displays fine -- except with no formatting.
Whether I set the TableStyles or not it displays the same way -- all the columns are aligned to the left and they are all the same width -- no matter how or where I set them.
Here's where I tried setting them in code:
Code:
Dim dgStyle As DataGridTableStyle = New DataGridTableStyle()
Dim textColumn As New DataGridTextBoxColumn()
dgStyle.GridColumnStyles.Clear()
'ShellID
textColumn.MappingName = "ID"
textColumn.HeaderText = "ID"
textColumn.Width = 2
textColumn.ReadOnly = True
dgStyle.GridColumnStyles.Add(textColumn)
'PurchaseOrder
textColumn.MappingName = "PurchaseOrder"
textColumn.HeaderText = "PO"
textColumn.Width = 80
textColumn.Alignment = HorizontalAlignment.Left
textColumn.ReadOnly = True
dgStyle.GridColumnStyles.Add(textColumn)
'Reason
textColumn.MappingName = "Reason"
textColumn.HeaderText = "Rsn"
textColumn.Width = 40
textColumn.Alignment = HorizontalAlignment.Center
textColumn.ReadOnly = True
dgStyle.GridColumnStyles.Add(textColumn)
'BeginBill
textColumn.MappingName = "BeginBill"
textColumn.HeaderText = "StartDate"
textColumn.Width = 60
textColumn.Alignment = HorizontalAlignment.Center
textColumn.ReadOnly = True
dgStyle.GridColumnStyles.Add(textColumn)
...
...
...
DataGrid1.TableStyles.Add(dgStyle)
The data displays fine -- except with no formatting.