October 30, 2009

Creating a WPF Control

Posted in Quick Guide tagged , , , at 21:15 by winglinglang

Here is Some Basic Stuff to remember when creating a new WPF Control.

1. Remeber to set the the static property DefaultStyleKeyProperty This property links your XAML style to your Control. If you dont set this property a Default style settings your Control will not find the contol type to set it.

Example:

DefaultStyleKeyProperty.OverrideMetadata(typeof(ControlName), new FrameworkPropertyMetadata(typeof(ControlName)));

2. a Generic Control should focus on properties and functions to maunipilate the control behaviour and display.