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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:34:54+00:00 2026-05-11T09:34:54+00:00

I have a listbox which is databound to a collection of objects. I want

  • 0

I have a listbox which is databound to a collection of objects. I want to modify the way the items are displayed to show the user which one of these objects is the START object in my program.

I tried to do this the following way, but the listbox does not automatically update. Invalidating the control also didn’t work.

The only way I can find is to completely remove the databindings and add it back again. but in my case that is not desirable.

Is there another way?

class Person : INotifyPropertyChanged {     public event PropertyChangedEventHandler PropertyChanged;      private string _name;     public string Name     {         get         {             if (PersonManager.Instance.StartPerson == this)                 return _name + ' (Start)';                                   return _name;         }         set         {             _name = value;             if (PropertyChanged != null)                 PropertyChanged(this, new PropertyChangedEventArgs('Name'));         }     }      public Person(string name)     {         Name = name;     } } 

This is the class wich manages the list and the item that is the start

class PersonManager {     public BindingList<Person> persons { get; set; }     public Person StartPerson { get; set; }      private static PersonManager _instance;     public static PersonManager Instance     {         get         {             if (_instance == null)             {                 _instance = new PersonManager();             }             return _instance;         }     }      private PersonManager()     {         persons = new BindingList<Person>();     } } 

In the form I use the following code

    private void button1_Click(object sender, EventArgs e)     {         PersonManager.Instance.StartPerson = (Person)listBox1.SelectedItem;     } 
  • 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. 2026-05-11T09:34:54+00:00Added an answer on May 11, 2026 at 9:34 am

    I’m pretty sure that the problem is that, when you do this, you’re effectively making the Person.Name properties ‘get’ accessor change the value (and act like a set accessor as far as the UI is concerned).

    However, there is nothing that’s updating the bindings to say that this is happening. If PropertyChanged got called when you set start, I believe this would update.

    It’s clunky, but the way you have it written, I believe you could add this and make it work (NOTE: I didn’t test this, so it ~may~ have issues):

    private void button1_Click(object sender, EventArgs e) {     Person newStart = (Person)listBox1.SelectedItem;     if (newStart != null)     {         PersonManager.Instance.StartPerson = newStart;         newStart.Name = newStart.Name; // Dumb, but forces a PropertyChanged event so the binding updates     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListBox which displays items of variable height. I want to show
I have a ListBox which uses a DataTemplate to render databound items. The XAML
I have a Listbox with its ItemsSource property databound to a collection of objects.
I have one ListBox which has three Items in it. And also has one
I have a listbox that is databound to a Collection of objects. The listbox
I have a databound listbox which is actually displaying two columns of data. It
I have a listbox which acts as a list of items. If you click
So, I have a ListBox which is bound to a list of business objects,
I have a listbox which has couple of items. When double clicked on each
I have a ListBox which is databound to an ObservableCollection and has a complex

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.