1. 快速定义类的属性与函数
输入ctor+两次Tab键:定义类的构造函数
public Student()
{
}
输入prop+两次Tab键:定义不带private字段的属性
public int MyProperty { get; set; }
输入propfull+两次Tab键:定义带private字段的属性
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
输入propdp+两次Tab键:定义依赖属性
public int MyProperty
{
get { return (int)GetValue(MyPropertyProperty); }
set { SetValue(MyPropertyProperty, value); }
}
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.Register("MyProperty", typeof(int), typeof(ownerclass), new PropertyMetadata(0));
输入propa+两次Tab键:定义附加属性
public static int GetMyProperty(DependencyObject obj)
{
return (int)obj.GetValue(MyPropertyProperty);
}
public static void SetMyProperty(DependencyObject obj, int value)
{
obj.SetValue(MyPropertyProperty, value);
}
// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.RegisterAttached("MyProperty", typeof(int), typeof(ownerclass), new PropertyMetadata(0));