This documentation is archived and is not being maintained.

AdornedElementPlaceholder Class

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

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

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 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0