AdornedElementPlaceholder Class

Represents the element used in a ControlTemplate to specify where an adorned control is placed relative to other elements in the ControlTemplate.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public class AdornedElementPlaceholder : FrameworkElement, IAddChild
/** @attribute ContentPropertyAttribute("Child") */ 
public class AdornedElementPlaceholder extends FrameworkElement implements IAddChild
public class AdornedElementPlaceholder extends FrameworkElement implements IAddChild

Use this class only if you are creating a ControlTemplate that serves as a custom validation ErrorTemplate to provide visual feedback when the user input is not valid.

For example, you might want a red exclamation point to appear next to a text box when the input is not valid, as in the following illustration.

Data binding validation error

The following example shows how to use a ControlTemplate with AdornedElementPlaceholder to create the adorned TextBox in the preceding illustration.

<ControlTemplate x:Key="validationTemplate">
    <TextBlock Foreground="Red" FontSize="20">!</TextBlock>

The AdornedElementPlaceholder element specifies where the control being adorned (the TextBox in this case) should be placed.

You can then specify your template as the ErrorTemplate for your TextBox, as in the following example.

<TextBox Name="StartDateEntryForm" Grid.Row="3" Grid.Column="1" 
    Validation.ErrorTemplate="{StaticResource validationTemplate}" 
    Style="{StaticResource textStyleTextBox}" Margin="8,5,0,5">
        <Binding Path="StartDate" UpdateSourceTrigger="PropertyChanged" 
            Converter="{StaticResource dateConverter}" >
                <src:FutureDateRule />

For the complete sample, see Data Binding Demo or the Data Validation section in Data Binding Overview.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0