No constructor for type '{0}' has {1} parameters

This error occurs when you provide the wrong number of parameters to the constructor of a MarkupExtension.

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

Error ID: XAML0506

Note

This error message also applies to the Silverlight Designer.

To correct this error

Example

The following code example shows how to declare a static resource and use it in a markup extension. The StaticResourceExtension constructor takes, at most, one parameter. The second declaration passes two parameters to the StaticResourceExtension constructor. Uncomment the second Button declaration to raise XAML0506.

<DockPanel>
    <DockPanel.Resources>
        <ResourceDictionary >
            <LinearGradientBrush x:Key="NormalBrush" EndPoint="0,1" StartPoint="0,0">
                <GradientStop Color="#FFF" Offset="0.0"/>
                <GradientStop Color="#CCC" Offset="1.0"/>
            </LinearGradientBrush>
        </ResourceDictionary>
    </DockPanel.Resources>

    <Button Background='{StaticResource NormalBrush}'>OK</Button>

    <!-- Uncomment the following line to raise error XAML0506. -->
    <!-- <Button Content='{StaticResource NormalBrush, Undefined}' /> -->
</DockPanel>

See Also

Reference

MarkupExtension

Concepts

XAML Errors and Help

Markup Extensions and WPF XAML

Other Resources

XAML in WPF

XAML in Silverlight