Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1005961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:22:52+00:00 2026-05-16T08:22:52+00:00

I have a listbox bound to a collection. I would like the ListBox to

  • 0

I have a listbox bound to a collection. I would like the ListBox to always reverse the order of the items. This handler–hooked up to the control’s load event–works for the initial load, but not thereafter. Ive tried using the SourceUpdated event but that doesnt seem to work.

How do I maintain a constant active sort?

    MyList.Items.SortDescriptions.Add(New SortDescription("Content", ListSortDirection.Descending))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:22:52+00:00Added an answer on May 16, 2026 at 8:22 am

    How is the collection stored that supplies the items for the ListBox? It should be a collection that supports INotifyCollectionChanged. The framework provides ObservableCollection<T> which you can use.

    In the constructor of your ViewModel (or wherever the collection lives), you then get the DefaultView for adding the SortDescription. The CollectionView is like a layer on top of your collection, which you can use to sort, group, filter, etc. the items without actually affecting the underlying data source. The framework creates a default one for you. To get a reference to it, you can use code similar to the following:

            var collectionView = CollectionViewSource.GetDefaultView(Widgets);
            if(collectionView == null)
                return;
    
            collectionView.SortDescriptions.Add(new SortDescription("Content", ListSortDirection.Descending));
    

    With that in place, you should be able to add items to the ObservableCollection<T> and the sort order will be maintained.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listbox bound to a view model observable collection: This works fine,
I have a ListBox bound to an ObservableCollection. The items in the collection each
I have a ListBox bound to a list of Items (for arguement, lets say
I have a data bound listbox that lists names of items, I am now
Say I have a ListBox that is bound to an observable collection on my
I have a ListBox which is bound to a collection. When I add an
I have an observable collection bound to a listbox in WPF. One of the
I currently have a view that contains a ListBox bound to a a collection
I have a listbox that is bound to a List<T> -- this is working
I have a ListBox bound to a collection of objects, and everything works except

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.