问题
Can anyone explain how is dependency property implemented? Is it just a static dictionary that is declared in base class with a reference of given instance as a key?I can't find any resources about this in internet...
Thanks a lot
回答1:
I see two questions:
- How do dependency properties work? The MSDN article on Properties in WPF is a great series on dependency properties. Should be a good overview to get you started.
- How are dependency properties implemented? You won't find any resources on this because why would Microsoft want to expose their implementation of DP? That being said, that's certainly open to discussion.
回答2:
...a few years later.
and there is already a source code browser for .NET. You can study how it is implemented here: DependencyProperty.cs
来源:https://stackoverflow.com/questions/880950/how-is-dependency-property-implemented