In my scenario I have a lot of buttons or other controls which I want to depend upon a public property inside the code-behind file. Let's call this IsEverythingLoaded and it's a boolean.
Now I would like to have a button look like this
<Button Click="DoTheMagic"
IsEnabled="{Binding Path=IsEverythingLoaded}">Click Me</Button>
To even get this running I figured out I need to point it to the Relative Source, so by adding this to my <Window>
decleration, I got the initiation and visualisation to work.
DataContext="{Binding RelativeSource={RelativeSource Self}}"
However, lets say that I raise an event with another button, which then were to set IsEverythingLoaded
to true
, I would imagine that IsEnabled
on each button would too. And therefore be clickable again, but I was wrong, isn't this how DependencyProperties should work?
To Clarify..
I do NOT wish to write IsEverythingLoaded as a DependencyProperty. I want the Button to Depend on A CLR Property