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
Post a Comment