djcouchycouch
djcouchycouch

Reputation: 12832

A Window Binding to Self?

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!

Upvotes: 4

Views: 243

Answers (2)

Jobi Joy
Jobi Joy

Reputation: 50038

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.

Upvotes: -1

Pavel Minaev
Pavel Minaev

Reputation: 101585

<Window DataContext="{Binding RelativeSource={RelativeSource Self}}">

Upvotes: 6

Related Questions