Share via


Walkthrough: Interpreting XAML Errors in the WPF Designer

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

This topic shows how to get Help when errors occur while loading Extensible Application Markup Language (XAML) in the WPF Designer for Visual Studio. 

Tasks explained in this walkthrough include:

  • Creating the project.

  • Generating a XAML loader error.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

Prerequisites

You need the following components to complete this walkthrough:

  • Visual Studio 2012 RC.

Creating the Project

The first step is to create the project for the application.

To create the project

To generate a XAML error

  1. In XAML view, generate an error by adding a space after the open angle bracket of the <Grid> tag. The XAML should look like the following.

    <Window x:Class="DemoApplication.MainWindow"
        xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="300" Width="300">
        <!-- The following line has error XAML0302. -->
        < Grid>
    
        </Grid>
    </Window>
    

    An error appears in the Error List window: "Invalid white space. White space cannot follow the open angle bracket character '<' in an element tag." When you switch to Design view, the following message appears. "The document contains errors that must be fixed before the designer can be loaded. Reload the designer after you have fixed the errors."

  2. Double-click the error in the Error List. "

    The Grid element's opening tag is highlighted in XAML view.

  3. Press F1 to open Help.

    The Help topic for error XAML0302 opens.

See Also

Tasks

Walkthrough: Editing XAML in the WPF Designer

Reference

Invalid white space

Error List Window

Concepts

Split View: Viewing the WPF Design Surface and XAML at the Same Time

XAML Parser Architecture

XAML Overview (WPF)

Other Resources

Error Message Reference for the WPF Designer

WPF Designer

Using Resources