my sfdatagrid is being populated using datatable. here is code
DT - Datatable having Columns GLName (Text), GLBal (Decimal)
GLBal can be any decimal Negative, Zero, Positive
Here is vb.net code to populate sfdataGrid (LV)
LV.Columns.Add(New sync.Grid.GridTextColumn With {.MappingName = "GLName", .HeaderText = "Name", .Width = 200})
LV.Columns.Add(New sync.Grid.GridNumericColumn With {.MappingName = "GLBal", .HeaderText = "Balance", .Width = 150, .TextAlignment = TextAlignment.Right,
.DisplayBinding = New Binding With {.Path = New PropertyPath("GLBal"), .Converter = New GLBalConverter}})
LV.GroupColumnDescriptions.Add(New sync.Grid.GroupColumnDescription With {.ColumnName = "GLBal", .Converter = New BalDrCrConverter})
LV.ItemsSource = DT
Here is vb.net code for GLBalConverter
Public Class GLBalConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Dim Amt As Decimal = CDecRnd(value)
If Amt > 0 Then : Return String.Format("{0:N2} Dr", Amt)
ElseIf Amt < 0 Then : Return String.Format("{0:N2} Cr", (Amt * (-1)))
Else : Return "-" : End If
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Here is vb.net code for BalDrCrConverter
Public Class BalDrCrConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Dim TAmt As Decimal = CDec(value)
If TAmt > 0 Then
Return "Customer (Outstanding Amount Receivable)"
ElseIf TAmt < 0 Then
Return "Supplier or Party (Outstanding Amount Payable)"
Else
Return "Nil Ledgers"
End If
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
I want result as
---------------------------------------------------------------------------------------------------------
Name Balance
---------------------------------------------------------------------------------------------------------
Customer (Outstanding Amount Receivable)
ABC 263.00 Dr
XYZ 113.00 Dr
AAA 781.00 Dr
Supplier or Party (Outstanding Amount Payable)
QWE 769.00 Cr
UIO 789.00 Cr
Nil Ledgers
MNO -
PQR -
How can I achieve this or where am I wrong in above codes
Thanks in advance
Amit Saraf