Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

wpf and EF - sort data before filling datagrid

$
0
0

I'm new to EF (version 6.0.1) and fairly new to WPF.  Using this tutorial, I've created a master/detail scenario.  The following code was generated to bind the datagrid to the EF.

        Dim TblPatientDemographicViewSource As System.Windows.Data.CollectionViewSource =
            CType(Me.FindResource("TblPatientDemographicViewSource"), System.Windows.Data.CollectionViewSource)
        'Load data by setting the CollectionViewSource.Source property:
        'TblPatientDemographicViewSource.Source = [generic data source]
        _context.tblPatientDemographics.Load()
        TblPatientDemographicViewSource.Source = _context.tblPatientDemographics.Local

The data displays sorted by the primary key.  I would like to sort it by Patient Name. 

I've been reading about SortDescriptions, which sounds like what I want, but I can't get further than this:

TblPatientDemographicViewSource.SortDescriptions.Add(New ...

According to MSDN, I should be able to add a new sortdescription, but that's not an option that's given. I should be able to enter "TblPatientDemographicViewSource.SortDescriptions.Add(NewSortDescription("PatientName", ListSortDirection.Ascending))" But the 2nd SortDescription is not available to me.


Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles