Window tying to itself?

I am trying to set the datacontext Window for myself, but I cannot figure out what the syntax should be.

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

It doesn't seem to work.

Any ideas?

Thanks!

+4
source share
2 answers
 <Window DataContext="{Binding RelativeSource={RelativeSource Self}}"> 
+7
source

What about

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

I do not see the purpose of your requirement. If you install Window.DataContext from any part of your application, you really don't need another binding. Your DataContext should already be set without a binding expression.

0
source

All Articles