Share via


Extensibility Changes in Visual Studio 2010

The WPF Designer for Visual Studio provides a sophisticated platform for implementing custom design experiences for WPF and Silverlight controls. The WPF Designer Extensibility API has evolved significantly since its initial release in Visual Studio 2008. The following sections describe the changes in WPF Designer Extensibility for Visual Studio 2010. 

Support for Silverlight and Multiple Platform Versions

In Visual Studio 2008, control design times were able to target only the latest WPF platform version. In Visual Studio 2010, this support is extended across multiple platforms, including design-time support for WPF 3.5, WPF 4, Silverlight 3, and future platform releases. As the same extensibility API exists for all these platforms, control design-time authors can easily write one experience and share it across the control runtimes for each platform.

Support in Expression Blend

Your control design-time implementations can now target Expression Blend, by using the same extensibility interface available in Visual Studio. You may decide to ship separate or common design-time experiences for the two authoring environments.

Registering Metadata

The most significant difference in the extensibility API is that the IRegisterMetadata interface has been replaced with the IProvideAttributeTable interface. This change, coupled with enabling multiple platform support, has created breaking changes in the extensibility API. This means that existing control design-time implementations for Visual Studio 2008 will not load in Visual Studio 2010.

In addition, in Visual Studio 2010, you use the ProvideMetadataAttribute attribute to indicate that a design-time assembly provides metadata to the designer.

New Extensibility Points

The new extensibility API also supports new design-time experiences, including the following:

  • In the Properties window, support for accessing the model from category editors. This change is coupled with elevation of common properties to the top of the category listing, to enable control authors to provide rich editing experiences in the Properties window.

  • New AdornerPanel utility methods for enabling easier adorner placement relative to the custom control.

  • New programming model for sharing design-time implementations among different design tools, such as Visual Studio and Expression Blend.

  • New programming model for sharing design-time implementations among multiple target frameworks.

Comparing Extensibility in Visual Studio 2008 and Visual Studio 2010

The following table summarizes the differences between authoring custom design-time experiences in Visual Studio 2008 and Visual Studio 2010.

Visual Studio 2008

Visual Studio 2010

To register design-time types, implement the IRegisterMetadata interface and use the MetadataStore class.

To register design-time types, implement the IProvideAttributeTable interface and call the CreateTable method.

You do not need to add assembly-level attributes.

You must mark design-time assemblies with the ProvideMetadataAttribute attribute.

To associate a designer type with a graphical element, use the GetImage method on NewItemFactory, which can return various element types.

To associate a designer type with an icon, use the GetImageStream method to return a bitmap. Only bitmaps are supported.

To access model properties, use the dependency property, for example:

ModelProperty backgroundProperty = adornedControlModel.Properties[Control.BackgroundProperty];

To access model properties, use the name of the dependency property, for example:

ModelProperty backgroundProperty = adornedControlModel.Properties["Background"];

In addition, you can define a PropertyIdentifier, which is a type/string combination. PropertyIdentifier is used with attached properties when a simple name lookup is not sufficient.

To distinguish between layout space and render space, use the AdornerCoordinateSpaces class.

The AdornerCoordinateSpaces class is not used.

To specify the adorner location relative to content, use the AdornerPlacementCollection class.

To specify the adorner location relative to content, use the SetAdornerHorizontalAlignment, SetAdornerVerticalAlignment, and SetAdornerMargin methods. The AdornerPlacementCollection class is retained for backward compatibility.

See Also

Other Resources

WPF Designer Extensibility