Binding controls inside a collection?

Try adding DataContext = this to the constructor.

Yes, I can confirm the DataContext is set and that the property type of MyProp matches the type used in the DataContext. Setting the DataContext is part of a more elaborate MVVM which I figured was outside the scope of the example. I can, however, successfully bind to properties on the DataContext from inside the OrderDetailsView.

I just can't get MyProp to bind to the DataContext. – mbursill Sep 14 '11 at 21:09.

I found a solution: On my window, the view is shown in a ContentPresenter: The content property is set to the View via the code-behind. As I said in my question, "I am binding the ToolbarGroups property to an ItemsControl in my window. " So I display the ToolbarGroups elsewhere in the window with this: The ToolbarGroup objects couldn't bind to the DataContext of the View because they were added to the visual tree outside the view.

I was able to fix it by binding the DataContext of each item in the ItemsControl to the DataContext of the ViewPresetner content. It looks like this: It's a bit messy but it works. I'm certainly open to a more elegant solution if anyone has one.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions