开发者

How do I bind to a property on the DataContext without using a DependencyProperty?

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜