Choice element must contain a Requires attribute

The Choice element must have a valid Requires attribute declaration.

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

Error ID: XAML0408

Note

This error message also applies to the Silverlight Designer.

To correct this error

  • Ensure that each Choice element has a correctly declared Requires attribute.

Example

The following code example shows how to define fallback content with the AlternateContent element. Remove the Requires declaration to raise error XAML0408.

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

            <mc:AlternateContent>
                <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 in WPF

XAML in Silverlight

Markup Compatibility (mc:) Language Features