c# - My ViewModel should inherit from DependencyObject? -


okay goal set binding in code instead of xaml. source property custom dependency property string. target property located in viewmodel, , string, not dependency property (since viewmodel isn't dependencyobject, of course).

so target property string property (we call property mytextproperty).

this binding approach works via xaml (only tried x:bind far), can't seem able pull off pure c#.

bindingoperations.setbinding() expects target dependency property, mytextproperty simple string property located in viewmodel.

i want know if there way make work. viewmodel need dependencyobject? seems work if was, although never tried it. approach considered pattern/practice? appreciated. thanks.

a possible solution create binding onewaytosource or twoway binding. in way it's possible bind dependencyproperty of control , "normal" property in viewmodel


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -