When working with WPF, though this is applicable universally, a lot of
times you end up working with both the old WinForms stuff and the new
WPF stuff.  The object names between the two namespaces are almost
identical which can be a real pain meaning anytime you reference “Label”
in code (but outside the XAML) you have to use the fully-qualified
namespace.  Well, you can short cut (alias) that by doing the following:

// WPF namespace
 using WPF = System.Windows.Controls;
 // WinForms namespace
 using WinForms = System.Windows.Forms;

Huh, an equals in the namespace?  Yes, and now rather then having to use
System.Windows.Controls.Label for a WPF label or
System.Windows.Forms.Label for a WinForms label you can just use WPF.Label
for a wpf label and WinForms.Label for a WinForms label.  That should
save you some typing!

Leave a Reply

Your email address will not be published. Required fields are marked *

FormatException

928 East Plymouth Drive Asbury Park, NJ 07712