I know how to bind to a DependencyProperty
and how to create my own DependencyProperty
's. Is there a开发者_如何学C way to get the value from the DataContext
of the control in its code behind using the binding system (i.e. not reflection)? I'm considering a method of binding directly to the code behind rather than having to bind through the interface. I know that I could just create a DependencyProperty and bind to that, but I was just wondering if there was a way using a BindingExpression
or something to forgo having to create a DependencyProperty
.
I'm using Silverlight 4 with Expression Blend 4 and Visual Studio 2010.
No, the only two ways you could do this are via reflection, or by creating a 'local' dependency property and binding that to your DataContext by some expression. There is no other 'magic' way!
精彩评论