Element '{0}' not defined in the markup compatibility namespace

The specified element is not supported by XAML markup compatibility. For more information, see Markup Compatibility (mc:) Language Features.

This error is raised when the file is a valid XML document, but is not a well-formed XAML document.

Error ID: XAML0402

To correct this error

  • Remove any elements which are not defined in the markup namespace.

Example

The following code example shows how to define fallback content with the AlternateContent element. Uncomment the element in the AlternateContent element to raise error XAML0402.

        <DockPanel xmlns:mc='https://schemas.openxmlformats.org/markup-compatibility/2006'
        xmlns:v1='assembly.v1'
        xmlns:v2='assembly.v2'
        mc:Ignorable="v2" >

            <mc:AlternateContent>
                <!-- Uncomment the following line to raise error XAML0402. -->
                <!-- <mc:Invalid/> -->
                <mc:Choice Requires='v2'>
                    <Button Content='V2' />
                </mc:Choice>
                <mc:Fallback>
                    <Button Content='V1'/>
                </mc:Fallback>
            </mc:AlternateContent>

        </DockPanel>

See Also

Concepts

XAML Errors and Help

Other Resources

XAML

Markup Compatibility (mc:) Language Features