Bind to Objects which are not in the visual tree

Topics: Questions
Mar 27, 2013 at 9:36 AM
Hello

Have a control of infragistics. I want to set the the AllowEdit Property in the class FieldSettings.
Problem ist that FieldSettings is not in the visual tree. So I need a static Resource of the Datacontext like here:

http://www.infragistics.com/community/blogs/josh_smith/archive/2008/06/06/binding-a-xamdatagrid-field-property.aspx

Problem in Catel:

The only place where I can add the viewmodel to the Resources via Code, is in the Method GetViewModelInstance where I create the viewmodel. But thats atfer InitializeComponent.

How to solve such thinks?
Apr 2, 2013 at 5:51 PM
You can add the Resource anywhere you want. Just make it a DynamicResource and update it every time in the OnViewModelChanged method.
Apr 3, 2013 at 8:01 AM
Thanks for you answer. However found an better solution. It's called DataContextProxy.
Here is an creat explanation: http://kajanus.net/?p=15