Share via


Property elements cannot be in the middle of an element's content

Property elements cannot be in the middle of an element's content. They must be before or after the content.

This error is occurs when you attempt to use property-element syntax within an element's content.

This error is raised when the file is a well-formed XAML document, but contains one or more type mismatches.

Error ID: XAML0509

To correct this error

  • Move the property element to a position before or after the content.

Example

The following code example shows how to assign a value by using property-element syntax. The assignment occurs before the content elements.

Uncomment the second property assignment to raise error XAML0509.

<StackPanel>
    <StackPanel.Width>100</StackPanel.Width>
    <Button />
    <!-- Uncomment the following line to raise error XAML0509. -->
    <!--<StackPanel.Height>100</StackPanel.Height>-->
    <Button />
</StackPanel>

See Also

Concepts

XAML Errors and Help

Other Resources

XAML

Properties