We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Set up customized group

Thread ID:

Created:

Updated:

Platform:

Replies:

124204 May 24,2016 08:28 AM May 26,2016 12:25 AM WPF 1
loading
Tags: SfDataGrid
Amit Saraf
Asked On May 24, 2016 08:28 AM

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

Srinivasan Vasu [Syncfusion]
Replied On May 26, 2016 12:25 AM

Hi Amit, 
 
We considered this “Custom grouping sample in vb” of SfDataGrid and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates. 
 
Regards,
Srinivasan
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;