Home Forums WPF controls Xceed DataGrid for WPF Ordering for Column with ForeignKeyDescription not possible

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #41564 |


    We defined
    a ForeignKeyDescription for one of our Columns.

    DatagridCollectionViewSource for the Datagrid provides a GUID for this Column.

    In the
    ForeignKeyDescription we bound a CollectionViewSource as Itemsource.

    CollectionViewsource has a ObservableCollection of a Simple Custom Class as

    The Custom
    Class has two Properties (GUID and Name).

    We Use a
    ForeignKeyConverter for the DataTableForeignKeyDescription.

    works as it should:

    The Name is
    displayed, a corrrect Combobox opens on Editmode and Filtering with
    Autofiltermethod provides the distinct names not the GUID.



    When we try
    to Sort that Column, it`s not working.

    Not even 2
    Elements with the same GUID or name stay together.

    We tried to
    use a SortComparer for this Column, but we only get “Nothing” for
    both CompareObjects.

    If we group
    by this column, the grouping is done correctly, and when sorting after grouping
    the GUID is provided to the SortComparer.


    I added a small project to this post, so you can see the error.

    Informations about the small project:

     You can find the simple custom Class, the Comparer and the converter in SystemTypes.vb

    The problem column is “Type” with the title “Typ”


    Thanks in advance




    PS: Sorry for the mistakes. i`m not a native english speaker.

    Imported from legacy forums. Posted by Data (had 8 views)

    Fawzi [Xceed]
    Post count: 722



    For sorting to work, you would have to provide a DataType for the ItemProperty definition. I added the DataType property to your “Type” ItemProperty and sorting worked (without the GetValueFromKey) method. The code snippet I used as a definition of the Type property is:


                    <xcdg:DataGridItemProperty Name=”Type” DataType=”{x:Type sys:String}”  Title=”Typ” SortComparer=”{StaticResource _SystemTypesComparer}”>


                            <xcdg:DataTableForeignKeyDescription ItemsSource=”{Binding Source={StaticResource cvs_SystemTypes}}”

                                                           ValuePath=”ID” DisplayMemberPath=”TypeNo”

                                                           ForeignKeyConverter=”{StaticResource _SystemTypesConverter}”/>



    Imported from legacy forums. Posted by Fawzi [Xceed] (had 4 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.