views:

18

answers:

1

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 it'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?

A: 

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

eshalev
You can mark your own question as correctly answered by your answer if you like. That helps us see which people still need help and will improve your acceptance rate (currently 0%).
Lunivore