views:

65

answers:

2

I'm trying to get a Window's datacontext to be set to itself, but I can't figure out what the syntax should be.

<Window x:Class=" ... 
    DataContext="{Binding Self}"

Doesn't seem to work.

Any ideas?

Thanks!

+3  A: 
<Window DataContext="{Binding RelativeSource={RelativeSource Self}}">
Pavel Minaev
works for me! :)
Steve the Plant
A: 

What about

<Window DataContext="{Binding}".../>

I cant see the purpose of your requirement. If you are setting the Window.DataContext from any part of your application you really doesn't need another binding. Your DataContext must have already set with out a binding expression.

Jobi Joy