开发者

Binding Resources in XAML

I have a boolean flag in my DataContext which I would like a child control to use.

Problem:

I have a child control which uses i开发者_JAVA技巧t's own datasource. Hence, the datacontext of the entire page is not visibile to it. The child control needs to access this one property of the windows datacontext.

I have managed to use a static boolean value by sing a resource. The problem is that this resource is static (not bound to the datacontext)

Can I bind the value somehow to the datacontext? Is there another way to do this?


Solved it. The solution is to use ElementName. By giving my window a name I was able to access it's datacontext from the child control, regradless of the childs datacontext: http://www.netframeworkdev.com/windows-presentation-foundation-wpf/how-do-i-refer-to-the-current-window-in-xaml-82864.shtml

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜