Export (0) Print
Expand All

AdornerDecorator Class

Updated: September 2010

Provides an AdornerLayer for the child elements in the visual tree.

Namespace:  System.Windows.Documents
Assembly:  PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

public class AdornerDecorator : Decorator


An attempt is made to add more than a single child to the AdornerDecorator.

AdornerDecorator can contain only one child element. That element can contain multiple elements that can be adorned.

The AdornerDecorator specifies the position of the AdornerLayer in the visual tree. It is typically used in a ControlTemplate for a control that might host Adorner objects. For example, the ControlTemplate of a Window contains an AdornerDecorator so that the child elements of the window can be adorned. The GetAdornerLayer method returns null if you pass in an element that does not have an AdornerDecorator as an ancestor in its visual tree.

For more information about adorners and visual trees, see Adorners Overview and Trees in WPF.

The following example creates a ControlTemplate for a Window. The example adds a ContentPresenter as the child element of an AdornerDecorator. The logical child elements of the window can be adorned because the AdornerDecorator is in their visual tree.

<Style x:Key="{x:Type Window}" TargetType="{x:Type Window}">
  <Setter Property="SnapsToDevicePixels" Value="true"/>
  <Setter Property="Template">
      <ControlTemplate TargetType="{x:Type Window}">
        <Grid Background="{StaticResource WindowBackgroundBrush}">
          <ResizeGrip x:Name="WindowResizeGrip"
          <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
            <Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible"/>


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




September 2010

Enhanced topic.

Customer feedback.

Community Additions

© 2015 Microsoft