I have been putting VS2008’s support for WPF to the test; to see what improvements have been made since the Orcas extensions for VS2005 were released back in August of 2006. In case you have considered moving to VS2008 for your WPF development but aren’t sure if it is worth the 6 gig download and possible destabilization of your machine, perhaps this information will help you make a more informed decision.
O Intellisense, Intellisense, wherefore art thou Intellisense?
Before getting into the pros and cons of Orcas, let me first make an important statement for all you VS2005 + Orcas extension users out there. The standard XML Editor in Visual Studio no longer has XAML Intellisense! When I first opened up Orcas, whipped up a new WPF project, and opened Window1.xaml I quickly discovered that there was no Intellisense!
The XAML editor in Orcas is not the standard good old XML editor. It seems to be a new editor, and only this new XAML editor has Intellisense support. The old hackery in the VS2005 Orcas extensions, which used XSDs to provide XAML Intellisense, is no longer being used. The standard XML editor is now unaware of XAML.
If your default editor for XAML files is the XML Editor, you’ll need to change it. In Solution Explorer right-click on a XAML file, select “Open With”, and then choose the “Visual Studio Windows Presentation Foundation Designer” option, click the “Set as Default” button, and then click OK.
Pros and Cons
- The visual designer for WPF is more stable and has more features.
- It has cleaner and more organized XAML Intellisense, particularly when you use property element syntax.
- It has better XAML Intellisense support for attached properties (they appear as namespaces in the Intellisense window).
- There is a useful feature for mapping CLR namespaces into XAML, shows a list of CLR namespaces and which assemblies those namespaces are in. You just select the namespace/assembly you want to map and it writes out the rest for you. This even includes your “local” namespace too!
- Once a non-WPF namespace has been mapped into your XAML, the Intellisense will list types in that namespace, such as String, Int32, etc.
- Non-WPF types, such as your own classes, now have Intellisense support. For example, it will display the public properties on classes which you created.
- The context menus in Solution Explorer make it quick and easy to add a WPF Window, Page, UserControl, and ResourceDictionary.
- After adding a named element in XAML, you do not have to compile the project for that element to be available as a field in the code-behind. You only have to save the XAML file.
- The Property Window and XAML editor cooperate nicely. The Property Window displays the element selected in the editor, and changes made in either view appear in the other.
- Orcas crashes and throws odd errors much more often than VS2005, which is expected of a beta release, but still is annoying when you are trying to get work done.
- Auto-completion of an XML element close tag is missing. In the VS2005 + Orcas extensions editor, after you typed the closing angle bracket of an element it would automatically write out the element’s close tag for you. That feature is sorely missed.
- Support for auto-formatting of XAML is gone (i.e. Ctrl + E + D no longer works). That REALLY sucks.
- The WPF visual designer does not remember its state between runs. It always opens the visual designer on top, at the same size. Since I almost never want to use the visual designer, it’s annoying that I have to hide it every time I open a XAML file.
- The XAML editor does not auto-indent when you add a child element. You have to hit Tab (or the Spacebar several times) to indent the child element appropriately. This is just another time consuming task which I took for granted before.
- XAML Intellisense does not give an informative comment about a property or event; it only shows the type and member name.
- There is an inconsistent editing experience regarding auto-completed double quotes (“”). If the property being set has a well-known set of values, like Background, then when you select a value it adds the quotes. But for a property which requires you to type in the value, like Height, the quotes are not added. This breaks my XAML editing flow and I find myself having to go back and add in double quotes around attribute values more often than I’d like to admit.
- Giving an element a name in the Properties Window uses the Name property, instead of x:Name. I prefer x:Name for the sake of consistency since you cannot always use Name, but can always use x:Name. This should be configurable.
- If you create a new class in your project and want to use it in XAML, you must close the XAML editor/designer and reopen it for the type to appear in Intellisense.
- The Visual Designer should NOT always open by default when I view a .xaml file!!! It should remember my previous settings.
- I’d love to have Intellisense support in markup extensions, such as showing the properties of a Binding, and displaying available resource keys when using StaticResource or DynamicResource.
- I would also like it if there was Intellisense support for things like Setter.Property, Setter.Value, Trigger.Property, Trigger.Value, etc. That would make the whole styling system in WPF much more user-friendly.
The support for WPF in Visual Studio 2008 is headed in the right direction, but still has a ways to go before hitting the point where I would say that it is far superior to what the Orcas extensions for VS2005 provided. In some ways I think that the XAML editing experience has been degraded, but that might just be due to the fact that I’m so accustomed to the “old way” of doing things. Regardless, since Acropolis and LINQ can only be used in VS2008, I will be using VS2008 from now on.