Rubens Blog
Dependency Property Code Snippet 
Thursday, August 21, 2008, 02:45 PM
Posted by Ruben Steins
I'm a big fan of Visual Studio code snippets and keyboard shortcuts. So I really like typing prop followed by two tabs to quickly generate a property.

Today I found out a new one, specifically for WPF: propdp followed by double-tab gives you a Dependency Property and generates the following code:

public int MyProperty
{
get { return (int)GetValue(MyPropertyProperty); }
set { SetValue(MyPropertyProperty, value); }
}

// ... comment ...
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.Register("MyProperty", typeof(int), typeof(ownerclass), new UIPropertyMetadata(0));


You can fill in some fields, such as the type and the ownerclass, but besides that you don't have to type anything.
add comment ( 2 views )   |  permalink   |   ( 2.7 / 18 )

<<First <Back | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | Next> Last>>