Entity Framework - Sorting Relationproperties
-
Hi, my question is, how do I sort related items of an entity. In an invoice editing window, I have one ComboBox displaying all customers: XAML:
<UserControl.Resources> <CollectionViewSource x:Key="cvsCustomers" d:DesignSource="{d:DesignInstance local:Customer, CreateList=True}" />
...
</UserControl.Resources>
<ComboBox ItemsSource="{Binding Source={StaticResource cvsCustomers}}" .../>
Code-behind:
Dim cvsCustomers As System.Windows.Data.CollectionViewSource
cvsCustomers = CType(Me.FindResource("cvsCustomers"), System.Windows.Data.CollectionViewSource)Dim qryCustomers = _
From c In myEntities.Customers _
Order By c.CustomerCode
Select c
cvsCustomers.Source = qryCustomersNow I have a 2nd ComboBox displaying all contact persons of the selected customer. This works fine, but the entries in this second ComboBox are unsorted / sorted by ID. XAML:
<ComboBox ItemsSource="{Binding Path=myInvoice.Customer.Contacts}" .../>
; How do I get the list on the 2nd ComboBox sorted? King regards, and thanks in advance for tips/suggestions, Nico