次の方法で共有


The Blend 3 Asset Library

For Blend 3, we have completely re-designed the Asset Library. 

Here are some of the highlights:

a) Categorization for various assets makes discoverability easier.
b) Searchability allows for quick location of an asset across categories like Controls, Effects and Behaviors.
b) Freely dockable anywhere in the UI. We also have left the popup mode unchanged for quick one-time access to assets.
c) Extensible - you can register your own assets that make it easy for inclusion into the projects on an on-demand basis. Adding an asset like a Control or a Behavior will add all necessary references required for the functioning of the project automatically.
d) List and Grid modes for the display of assets.

Registering your own library (or sets of libraries) in the asset tool is very simple. All you have to do is to setup a registry key that points to a folder containing the libraries. As an example, the Silverlight SDK registers itself into the Blend asset tool using the following key/value pair on a 64-bit machine:
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Expression\Blend\3.0\Toolbox\Silverlight\v3.0\Silverlight SDK Client Libraries
Value: c:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\

For a WPF example, the following is the way the WPF ToolKit registers itself on a 32-bit machine:
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Expression\Blend\3.0\Toolbox\WPF\v3.0\WPFToolkit
Value: C:\Program Files\WPF Toolkit\v3.5.40320.1

There are a few things you can customize around the display of assets:

The Icon: For supplying a custom icon, all you need to do is to add an image to the control library (preferrably its design-time library that helps keep the size of the library small) that uses the namespace qualified name of the control for its name. For example, say you had a custom control Foo. The icon would be then called FoosNamespace.Foo.png. Few things to keep in mind: Use EmbeddedResource as the build item for the Image. Blend's asset library only supports PNGs. If you wanted a 24x24 and 12x12 version of icons (since we use these two standard sizes in various places of our UI), all you have to do is to name the PNGs as follows: FoosNamespace.Foo.SmallIcon.PNG, and FoosNamespace.Foo.LargeIcon.PNG. The SmallIcon/LargeIcon part don't actually matter - you can pick a string of your choice, and we will dynamically determine and pick up the appropriate icon for display.

Description: You can use the DescriptionAttribute to change the string that is displayed as a tooltip for the asset.

Asset Library availability: If you wanted to prevent a particular asset from being visble in the Asset Library, you could use the ToolBoxBrowsable attribute as a part of the metadata specification for that asset in the design-time library.

Location in the category hierarchy: Again done via a newly introduced attribute (ToolBoxCategoryAttribute) that you can supply via a design-time library.

Comments

  • Anonymous
    May 22, 2009
    PingBack from http://asp-net-hosting.simplynetdev.com/the-blend-3-asset-library/

  • Anonymous
    May 23, 2009
    Thank you for submitting this cool story - Trackback from DotNetShoutout

  • Anonymous
    May 25, 2009
    Check out this post by Unni (Program Manager with the Blend team). It’s a visual thing, yes, but it makes

  • Anonymous
    July 07, 2009
    I'm pulling my hair out because of ToolBoxCategoryAttribute. I can't put my controls in the Controls root folder in the toolbox of Blend 3. ToolboxCategoryAttribute("", true) puts the control in the Categories folder but not in the Controls folder. Somehow the toolbox can put stuff there (Accordion for example), but I can't see what I'm doing differently. Is this because the toolkit is signed by Microsoft?

  • Anonymous
    July 11, 2009
    Try ToolboxCategoryAttribute("Controls", true)

  • Anonymous
    August 03, 2009
    Can you provide some hints on the source code. I created a class called MetadataRegistration added references to Microsoft.Windows.Design.Extensibility and Interaction and implemented interface IProvideAttributeTable but can't see any change in expression. (The icon works in the .Design assembly).