понедельник, 9 ноября 2009 г.

New Options for Visual Studio 2010 Beta2 WPF and Silverlight Projects

ToolOptions

To get to this Options dialog, use the Tools menu, selected 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. Control’s 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.

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

3. Types deriving from Window or Page are ignored

4. FrameworkElements in other .exe projects are ignore

5. Internal classes will only be displayed when the active designer is for an item in the same project

6. Friend Assemblies are not taken into account for Toolbox Auto-Population

Комментариев нет: