Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Entity Framework - Sorting Relationproperties

Entity Framework - Sorting Relationproperties

Scheduled Pinned Locked Moved WPF
questionwpfwcfalgorithmssales
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nicolai Schrade
    wrote on last edited by
    #1

    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 = qryCustomers

    Now 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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups