Monday, September 3, 2012

WPF custom control and adding DependencyProperty to custom control


To create custom control in WPF, choose WPF Custom Control Library project in VS2010. Then rename the default added class to your choice. I am trying to create a custom list box with few user added properties in it. Then add a WPF project which will use this custom list box in it. So my solution structure is as follows –

Now I am going to add dependency properties in the class file. These properties will be then available in Properties window once you use the control in any WPF application.