Welcome to the Xceed Community | Help
Community Search  
More Search Options

DataGridCollectionViewSource and DataGridGroupDescription with objects

Sort Posts: Previous Next
  •  12-16-2011, 1:11 PM Post no. 31470

    DataGridCollectionViewSource and DataGridGroupDescription with objects

    Dear support forum,
    I have created in xaml a DataGridCollectionViewSource which works fine.
    Now I have added DataGridGroupDescription for a column (but the same happens if I just group the column with the mouse) but I have a problem:
    the items insde the cell are not strings or numbers, they are instance of a particular custom class, so each group has only one element (I am guessing this is the problem).

    Is there any way I can specify how to decide if an item is in a group or not?

    My custom class has unfortunatelly no "Equals" method, if can be usefull in any way my custom class has a To String method and a FieldValue property, if 2 items are the same (group) both To String and FieldValue will return the same thing.

    It will be very good if this could be done witout changing my custom class as I am writing a dll for a released application and I cannot alter that class.

    I really hope there is a way to do this!

    Thanks!

    <

    xcdg:DataGridCollectionViewSource x:Key="ReportDataDGCVSReference" Source="{Binding ReportData}">

    <xcdg:DataGridCollectionViewSource.StatFunctions>

    <vm:XceedStatDecimalFieldSum ResultPropertyName="MarketValueSum"

    SourcePropertyName="Market Value" />

    </xcdg:DataGridCollectionViewSource.StatFunctions>

    <xcdg:DataGridCollectionViewSource.GroupDescriptions>

    <xcdg:DataGridGroupDescription PropertyName="Position Type" />

    </xcdg:DataGridCollectionViewSource.GroupDescriptions>

    </xcdg:DataGridCollectionViewSource> 

  •  12-20-2011, 11:52 AM Post no. 31480 in reply to 31470

    Re: DataGridCollectionViewSource and DataGridGroupDescription with objects

    Any help on this please? It is quite urgent.

    The only workaround I have found is, in the view model, check the objects and replace them with a single one when the undelying value is the same... but it is not very good if I have to do this for each column Sad

  •  12-22-2011, 11:40 AM Post no. 31491 in reply to 31470

    Re: DataGridCollectionViewSource and DataGridGroupDescription with objects

    Thanks to Vanguard support I have a solution to this:

    <xcdg:DataGridCollectionViewSource x:Key="ReportDataDGCVSReference" Source="{Binding ReportData}">
    <xcdg:DataGridCollectionViewSource.GroupDescriptions>
    <xcdg:DataGridGroupDescription PropertyName="PositionType" />
    </xcdg:DataGridCollectionViewSource.GroupDescriptions>
    <xcdg:DataGridCollectionViewSource.ItemProperties>
    <xcdg:DataGridItemProperty Name="PositionType" DataType="{x:Type system:String}" 
    ValuePath="PositionType.PositionTypeVal"/>
    </xcdg:DataGridCollectionViewSource.ItemProperties>
    </xcdg:DataGridCollectionViewSource>

    Thanks!

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.