Wpf contentcontrol binding not updating


I have navigation set up with Main that has a Content Control.

Content property is bound to an object property in Main View Model.

I'm building a graphical designer, based upon an article by Sukram in Code Project.

I'm now trying to extend it so that each item on the canvas binds to a different View Model object - i.e. Every item on the designer is actually a Content Control, into which is placed a different template (based upon which toolbox item was dragged onto the canvas).

So I have a template containing a Text Box, and I have a View Model object containing a Name property, and I bind the Text property of the Text Box to the Name property of the View Model, and ... I've checked the visual tree with Snoop, and it confirms that the Data Context of the Text Box is the View Model object. And if I modify the (empty) Text in the Text Box, the Name property in the View Model does not change.

So it looks like the binding is not being applied (or has been removed somehow). Load Content does not preserve bindings - apparently Data Template. So it looks like I have to write my own version of Load Content(). Load Content(), but I realised that I didn't actually need a Data Template, since the Xaml Writer / Xaml Reader was already instantiating the UI element that I was after.

That may lead to a counterintuitive situation when you want to specify some UI element content and then use bindings in that content.