I have a an object created in Xaml:
<Grid>
<MyObject/>
</Grid>
I need someway to bind the object myObject back to a property in my view model. I dont know whether this is possible, everything ive seen so far binds properties together, but any help would be greatly appreciated.
I am assuming what you want is your
ViewModelto hold the actual visual controlMyObjectin it and yourGridto display it viaMVVM.This is possible through
ContentControlin WPF.Assuming your
ViewModelhas a propertyMyObjectViewwhich holdsMyObject…Having said that you must take caution that same
MyObjectViewis not bound to any other content control as that will result in an errorAnd if that requirement is possible then you must excercise
ContentTemplateoption.Let me know if this helps.