Use .Net runtime to store class properties
- Register
- DependencyProperty.Register(“X”, typeof(System.Int32), typeof(MyClass));
- Use
- (Int32)base.GetValue(MyClass.XProperty);
- base.SetValue(MyClass.XProperty, value);
Example:
class MyClass
{
public static DependencyProperty XProperty =
DependencyProperty.Register("X", typeof(System.Int32),
typeof(MyClass));
...
public Int32 X
{
get { return ((Int32)(base.GetValue(MyClass.XProperty))); }
set { base.SetValue(MyClass.XProperty, value); }
}
}