Provides attached properties to get or set a UIElement or DataTemplate as the adorner of FrameworkElement.

Namespace: DevZest.Windows
Assembly: DevZest.WpfDocking (in DevZest.WpfDocking.dll)

Syntax

C#
public static class AdornerManager
Visual Basic
Public NotInheritable Class AdornerManager

Remarks

AdornerManager provides two attached properties: Adorner to get or set UIElement as adorner of FrameworkElement; and AdornerTemplate to get or set DataTemplate as adorner of FrameworkElement. You can use these attached properties to declare adorner of FrameworkElement in XAML.

AdornerTemplate provides similar functionality as Adorner, however it can be used in style setters because direct UI child is not allowed. Both way the provided adorner inherits DataContext as adorned element.

Setting adorner for specified FrameworkElement will clear the adorner previously set, no matter using Adorner or AdornerTemplate attached properties.

Examples

The following example demostrates the usage of Adorner and AdornerTemplate attached property:
CopyXAML
<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dz="http://schemas.devzest.com/presentation">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Button Content="Button" Grid.Row="0">
            <dz:AdornerManager.AdornerTemplate>
                <DataTemplate>
                    <Grid Opacity="0.5">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Rectangle Fill="Blue"/>
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontStyle="Italic" Text="{Binding Content}" />
                    </Grid>
                </DataTemplate>
            </dz:AdornerManager.AdornerTemplate>
        </Button>
        <Button Content="Button" Grid.Row="1">
            <dz:AdornerManager.Adorner>
                <Grid Opacity="0.5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Rectangle Fill="Blue"/>
                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontStyle="Italic" Text="{Binding Content}" />
                </Grid>
            </dz:AdornerManager.Adorner>
        </Button>
    </Grid>
</Window>

Inheritance Hierarchy

System..::..Object
  DevZest.Windows..::..AdornerManager

See Also