Binding not working (NotifyPropertyChanged firing but PropertyChanged is null)

Hey, I'm suffering a strange case where just one of my bindings won't work. I'm not sure why it's failing but I think it has to do with the data structure I'm binding too.

My binding statement is this:
            <Label  x:Name="Cedent"  ...
                        Content="{Binding Source={x:Static Application.Current},
                                          Path=ExposureMetaDataList.TTProgramInfo.Cedent}" />

My App.cs class has a property called ExposureMetaDataList
This, in turn has a property called TTProgramInfo, which is also a data structure.
This class has one private variable which is a data structure ttProgramInfo, and 3 public prperties which expose three properties of that data structure. The one being accessed is:

        public string Cedent {
            get {
                return ttProgramInfo.Cedent;
            }
            set {
                ttProgramInfo.Cedent = value;
                NotifyPropertyChanged("Cedent");
            }
        }

When the property "Cedent" is changed, the set method gets called, as does NotifyPropertyChanged:

        public event PropertyChangedEventHandler PropertyChanged;

        protected void NotifyPropertyChanged(String propertyName)
        {
            if(PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

But when that function gets called, 'PropertyChanged' is null, and so nothing happens. Why is it null? For every other bound property, the PropertyChanged eventhandler is magically set to something, but not in this case. How can I figure this out?

Below is the code where the property gets set. Note that the data structure is being reset too (but this should not harm the binding since it's set in the XAML and the data structure is initialized dynamically anyways.
ttProgramInfo = new TTProgramInfoVM();
if(ds != null && ds.Tables[0].Rows.Count > 0)
{
    //TODO: None of these properties are firing approprate notify property change events.
     ttProgramInfo.TTID = Convert.ToInt32(ds.Tables[0].Rows[0]["TTID"]);
     ttProgramInfo.Cedent = (String) ds.Tables[0].Rows[0]["Cedent"];
     ttProgramInfo.CCY = (String) ds.Tables[0].Rows[0]["CCY"];
     ((QuartzShareUI.App) Application.Current).TTIDLoggedIn = true;
}

Open in new window

LVL 21
alainbrydenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alainbrydenAuthor Commented:
Ugh. Why does this always happen. I have a problem for 2 whole days, finally ask a question, and then solve it myself within an hour.

Turns out the reason was that in the above code, I was referring to the private local variable
private TTProgramInfoVM ttProgramInfo;
directly instead of using the public property I had created for it:
        public TTProgramInfoVM TTProgramInfo {
            get {
                return ttProgramInfo;
            }
            set  {
                ttProgramInfo = value;
                NotifyPropertyChanged("TTProgramInfo");
            }
        }

I had thought that since I was only looking for the property change events of the sub-properties of that data structure, that it wouldn't matter how I referenced that data structure.

Miraculously, the attached code solves the problem:

--
Alain
TTProgramInfo = new TTProgramInfoVM();
if(ds != null && ds.Tables[0].Rows.Count > 0)
{
    //TODO: None of these properties are firing approprate notify property change events.
     TTProgramInfo.TTID = Convert.ToInt32(ds.Tables[0].Rows[0]["TTID"]);
     TTProgramInfo.Cedent = (String) ds.Tables[0].Rows[0]["Cedent"];
     TTProgramInfo.CCY = (String) ds.Tables[0].Rows[0]["CCY"];
     ((QuartzShareUI.App) Application.Current).TTIDLoggedIn = true;
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.