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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:31:57+00:00 2026-05-13T07:31:57+00:00

I have been wrestling with getting databinding to work in WPF for a little

  • 0

I have been wrestling with getting databinding to work in WPF for a little over a week. I did get valuable help here regarding the DataContext, and I did get databinding to work via DependencyProperties. While I was learning about databinding, I came across numerous discussions about INotifyPropertyChanged and how it is better than DPs in many ways. I figured that I would give it a shot and try it out.

I am using Josh Smith’s base ViewModel class and my ViewModel is derived from it. However, I’m having a bit of trouble getting databinding to work, and am hoping that someone here can tell me where I’m going wrong.

In my ViewModel class, I have an ObservableCollection<string>. In my GUI, I have a combobox that is bound to this OC, i.e.

<ComboBox ItemsSource="{Binding PluginNames}" />

The GUI’s DataContext is set to the ViewModel, i.e.

private ViewModel _vm;

public GUI()
{
  InitializeComponent();
  _vm = new ViewModel();
  this.DataContext = _vm;
}

and the ViewModel has the OC named “PluginNames”:

public class ViewModel
{
  public ObservableCollection<string> PluginNames;  // this gets instantiated and added to elsewhere
}

When the GUI is loaded, a method is called that instantiates the OC and adds the plugin names to it. After the OC is modified, I call RaisePropertyChanged( "PluginNames"). I was expecting that since the WPF databinding model is cognizant of INotifyPropertyChanged, that this is all I needed to do and it would “magically work” and update the combobox items with the plugins that got loaded… but it doesn’t.

Can someone please point out what I’ve done wrong here? Thanks!

UPDATE: I’m not sure why, but now instead of not doing any apparent updating, it’s not finding the property at all. I think I’m being really stupid and missing an important step somewhere.

  • 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-13T07:31:57+00:00Added an answer on May 13, 2026 at 7:31 am

    It looks like you’ve exposed field not property. Bindings works for properties only… Change it to:

    public class ViewModel
    {
      public ObservableCollection<string> PluginNames {get; private set;} 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have been getting pretty bald over this situation! I am using MS VS 2010
We have been wrestling with the confines of ASP.NET trying to get JSONP working.
I have been wrestling with SvcUtil all day, trying to get it to generate
I have a complex object hierarchy that I've been wrestling with to get passed
I have been wrestling with this for hours and just can't make it work.
I've been wrestling with trying to get FlexSlider http://flex.madebymufffin.com/ to work with Drupal 7
I have been wrestling with this for a few days and after tons of
This is a thought problem, and one I have been wrestling with for about
I have been wrestling with a latex table for far too long. I need
Have been trying to fix this problem I have here. Basically I have a

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.