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 8653925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:39:35+00:00 2026-06-12T14:39:35+00:00

Listbox is updated every sec and during work I need to select some of

  • 0

Listbox is updated every sec and during work I need to select some of it’s items and execute a command, which is impossible, because listbox is updated and loses it’s selected item.

ObservableCollection is the ViewModel of my list.

I have some options in mind and perhaps there are better solutions:

  1. Detect new items in the list to be propagated and add new items to ObservableCollection without reinitializing ObservableCollection

  2. Detect changes in the old items and updated their fields if necessary.

This is somewhat cumbersome, though not difficult, but are there any other options?

Update, solution that I have

I’ve chosen the 3-d part: before an update has started, I save selected index of sorted collection and load a new collection and compare vs. old collection. I Know, this is not efficient, but for the current application this fits quite well: collections will never be more than some hundreds, ordinarily, no more 100. Each element of collection supports eager and lazy loading. And if there are changed items, they load their content from server, while other remain intact. And then I update observable collection, update changed items from server and set selected index in the viewmodel. Selecting an item manually solves the problem of losing focus after update.

  • 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-06-12T14:39:36+00:00Added an answer on June 12, 2026 at 2:39 pm

    Save the selected item’s key before the list is updated.
    Find it in the new version of the list, and re-select it.
    Don’t rely on the original reference, and allow for some other fellow removing it from the new list to select from.

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

Sidebar

Related Questions

A ListBox and a ContextMenu are created dynamicaly. The ListBox has some items. How
I have a listbox which has couple of items. When double clicked on each
I have some items populated in the listbox from the database in my asp.net
I want to display a ListBox with around 10 items in it. Every time
I have a WPF listbox and have updated the list item data template to
I have a ListBox and I need to repeat the styles to be the
I have a listbox on a page: <select id=user_list name=user_list size=21 style=width:200px;> <option value=1>User
I have a ListBox with items that fill TextBox es. How do I identify
In my WinForms application I have a timer which 'ticks' every second. In the
I have a listbox with items bound to an ObservableCollection. Now, from within the

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.