Tuesday 3 June 2014

Dependency Property in WPF

When you define your own properties and want them to support many aspects of Windows Presentation Foundation (WPF) functionality, including styles, data binding, inheritance, animation, and default values, you should implement them as a dependency property.

public static readonly DependencyProperty MyCustomProperty =

DependencyProperty.Register("MyCustom", typeof(string), typeof(Window1));public string MyCustom{ get { return this.GetValue(MyCustomProperty) as string; } set { this.SetValue(MyCustomProperty, value); }}

No comments:

Post a Comment