This question is locked. New answers and comments are not allowed.
Hi
I am trying to set the data format of a column using the DataFormatString property of a GridViewDataColumn object. No matter what format string i pass the format just does not change. Below is a code snippet
I am trying to set the data format of a column using the DataFormatString property of a GridViewDataColumn object. No matter what format string i pass the format just does not change. Below is a code snippet
Public Sub InitializeGrid(ByVal Data As Object, Optional ByVal ColumnList As List(Of GridColumn) = Nothing)
_ColumnList = ColumnList
_DataSource = Data
If Not ColumnList Is Nothing Then
rdgMain.AutoGenerateColumns = False
'Setup the columns
For Each col As GridColumn In _ColumnList
Dim column As New GridViewDataColumn()
column.DataMemberBinding = New Binding(col.ColumnName)
column.Header = col.ColumnHeader
column.UniqueName = col.ColumnName
column.DataType = col.Datatype
column.TextAlignment = col.TextAlignment
'Force a format to test with
column.DataFormatString = "{0:C}" 'col.FormatString
If Not ColumnExists(col.ColumnName) Then
rdgMain.Columns.Add(column)
End If
Next
End If
rdgMain.ItemsSource = Data
VisualStateManager.GoToState(Me, "IdleState", True)
End Sub