I'm trying to convert from WinForms to WPF and am struggling a bit with DataGridView -> WPF DataGrid.
I've got all the data loading nicely, just stuck on the cell formatting.
There is a column with numbers, however if the number is zero, rather than show 0, I'd like it to display NIL.
With DataGridView, the below worked
Private Sub SampleDGV_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles SampleDGV.CellFormatting
Try
If e.RowIndex >= 0 And e.ColumnIndex = SampleDGV.Columns(CostColumn.Name).Index Then
If CDec(e.Value.ToString) = 0 Then
e.Value = "NIL"
e.FormattingApplied = True
End If
End If
Catch ex As Exception
End Try
End Sub
But now I'm stumped on the WPF equivalent