0

Suppose I have a view with the following control (DataContext is properly set to a view model that implements INotify):

When the view is first shown, Document is non existant (null). During runtime (after the user opens a Document), then Document and dependent structure (including Document.SelectedFrame.Image) is created.

At that point, I do invoke the PropertyChaned handler of my SelectedFrame object (which also implements INotifyProperty), but nothing happens.

Do I have to re-tie the bindings at runtime when Document gets created?

2
  • If you say everything is done right, but it doesn't work, it is hard to help. Please post the pertinent code/XAML. Commented Dec 19, 2010 at 3:12
  • I didn't say everything is done right did I? Commented Dec 19, 2010 at 17:45

1 Answer 1

1

I assume you have a binding which looks something like this:

<Image Source="{Binding Path=Document.SelectedFrame.Image}"></Image>

You need to raise PropertyChanged on the ViewModel class when the value of Document changes. It should look something like this:

public object Document
{
    get { return document; }
    set
    {
        document = value;
        this.PropertyChanged(this, new PropertyChangedEventArgs("Document"));
    }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.