Probably not the most thrilling first post, but Dependency Properties are a big thing in WPF land.
A Dependency Property is a property that is registered with the Avalon Dependency property system. This is useful for 2 main reasons...
You can get the full low down on Dependency Properties here.
So, for reference, the code below shows how to create and register a Dependency Property within a class. The property is call 'MyNameProperty'. The code below declares and registers the Dependency property...
public
This next piece of code now provides access to the property...
}
Finally, I add an event to listen for the value changing - for example, if the property is animated or databound... (where 'nameText' is a TextBlock displaying the value of MyName)
private
myClass.nameText.Text = (
I can now use MyClass as a DataTemplate within an items control, binding MyName to a data context...
<
</
And that is a brief intro to dependency properties. I am sure i will go deeper into these in the future as i encounter more and more uses for them.
Martin