I found this on MSDN:
A dependency property value can be set by referencing a resource. Resources are typically specified as the Resources
property value of a page root element, or of the application (these locations enable the most convenient access to the resource). The following example shows how to define a SolidColorBrush
resource.
XAML:
<DockPanel.Resources>
<SolidColorBrush x:Key="MyBrush" Color="Gold"/>
</DockPanel.Resources>
Once the resource is defined, you can reference the resource and use it to provide a property value:
<Button Background="{DynamicResource MyBrush}" Content="I am gold" />
This particular resource is referenced as a DynamicResource Markup Extension . To use a dynamic resource reference, you must be setting to a dependency property, so it is specifically the dynamic resource reference usage that is enabled by the WPF property system.
My questions are:
- StaticResource is not considered Dependency Property? If yes why?
- Does not belongs to WPF Property System?
Also can you give me an example how to implement default value using Dependency Property?