Pros and cons of Visual Studio Orcas support for WPF

I installed the Visual Studio 2008 (‘Orcas’) Beta 1 recently.  The main reasons I decided to install Orcas were so that I can start learning about Acropolis and LINQ

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

PROS

  • 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.

CONS

  • 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.

Wish List

  • 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.

Conclusion

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.

8 Responses to Pros and cons of Visual Studio Orcas support for WPF

  1. Oran says:

    Check out the new XAML intellisense support in Resharper 3.0 that just came out this past week… it’s smart about things like resource keys when you use Static/DynamicResource. Supposedly it works in Orcas, but I’ve only used it in VS05 for now.

  2. Josh Smith says:

    Thanks for the tip, Oran. I’ll give it a shot!

    Josh

  3. Karl Shifflett says:

    Thank you for the reseach and posting the information. It is appreciated!
    Karl

  4. Josh Smith says:

    No problem, Karl. A month or so back I was looking for a listing of pros & cons regarding Orca’s WPF support. I never found one, so after I installed it I figured I should create one myself. “Be the change you want to see in the world”…or however that saying goes.🙂

    Thanks,
    Josh

  5. Thanks for this excellent feedback on the WPF designer in Visual Studio 2008. I’m a Program Manager on the team that’s building the designer; this sort of detailed feedback from our customers is very useful to us.

    I wanted to let you know that a number of the issues you have mentioned with the WPF designer in Beta 1 of Visual Studio 2008 have been resolved in the upcoming Beta 2 release, specifically:

    1. Auto-formatting now works in the new XAML editor, and a rich set of auto-formatting options has been introduced to allow you to gain more control over precisely how your XAML gets formatted in the editor.

    2. The WPF designer now remembers its state for a given XAML file in a given project between runs – so if you have switched a file to XAML only view, it will stay that way

    3. Auto-indenting now works in the XAML editor without needing to hit Tab

    4. New classes will now show up in XAML intellisense without the need to close and reopen the designer/editor

    5. When entering attributes which don’t have an enumerated value, we now we emit the first quote when typing the value

    Thanks again for the feedback and please keep it coming; it is much appreciated.

    Mark Wilson-Thomas
    Program Manager, “Cider” Team

    WPF Designer user?
    Submit your feedback on the WPF designer in Visual Studio 2008 here!:
    http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=169&SiteID=1

  6. Josh Smith says:

    Mark,

    I’m glad this blog post was useful for you.

    Josh

  7. Have you had a chance to take a look at the Beta 2 release yet Josh? If so, what do you make of it?

    Mark

  8. Josh Smith says:

    Mark,

    I have not yet downloaded Beta 2. If I do, I’ll probably post about it (hopefully more raves than rants!). 🙂

    Josh

%d bloggers like this: