Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

New Options for Visual Studio 2010 Beta2 WPF and Silverlight Projects

0.00/5 (No votes)
30 Oct 2009 1  
New Options for Visual Studio 2010 Beta2 WPF and Silverlight Projects

ToolOptions

To get to this Options dialog, use the Tools menu, select Options, select Text Editors, select XAML, select Miscellaneous.

MarkupExtension IntelliSense and Editing

The most requested feature for the WPF & Silverlight XAML Editor was MarkupExtension IntelliSense. This feature has been added to Visual Studio 2010 Beta2.

In addition to IntelliSense, you also get some entry helpers.

  1. When you type a { (left curly brace) Visual Studio will automatically insert the } (right curly brace) for you.

    You can disable this feature by un-checking the above option, “Closing braces for MarkupExtensions.”

  2. When you press the SPACEBAR inside {} (curly braces) Visual Studio will automatically insert a comma for you to the left of the space added by pressing the SPACEBAR.

    You can disable this feature by un-checking the above option, “Commas to separate MarkupExtension parameters.”

Toolbox Auto-Population

Visual Studio 2010 Beta2 now adds all Custom Controls and UserControls in the Solution to the Toolbox when you build the solution. Controls are added to a separate Toolbox tab for each project.

You can disable this feature by un-checking the above option, “Automatically populate toolbox items.”

How Auto-Population Works

When you build a project, its corresponding tab in the Toolbox is cleared and then all types that derive from FrameworkElement are added to the Toolbox tab for that project. (See Fine Print below for more details.)

When you build the solution, all projects Toolbox tabs are updated as explained above.

If you want to prevent an item from appearing in the Toolbox during the Auto-Population processing, decorate the class with the System.ComponentModel.DesignTimeVisible attribute and pass False in the constructor.

The following code snippet shows the DesignTimeVisible attribute decorating the CustomView UserControl. The CustomView UserControl will not appear in the Toolbox.

VB.NET
Imports System.ComponentModel

<DesignTimeVisible(False)>
Public Class CustomerView
    Inherits UserControl

End Class

Fine Print

To appear in the Auto-Population Toolbox process a type must derive from FrameworkElement and:

  1. Are public and have a default public or internal constructor or are internal and have either a default public or internal constructor
  2. Types deriving from Window or Page are ignored
  3. FrameworkElements in other .exe projects are ignored
  4. Internal classes will only be displayed when the active designer is for an item in the same project
  5. Friend Assemblies are not taken into account for Toolbox Auto-Population

Close

Have a great day.

Just a grain of sand on the world's beaches.

Posted in CodeProject, Silverlight, VB.NET, Visual Studio 2010, WPF Controls, WPF General

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here