Share via


IAdornerPlacement Interface

Specifies a placement term for an AdornerPlacementCollection.

Namespace:  Microsoft.Windows.Design.Interaction
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Syntax

'Declaration
Public Interface IAdornerPlacement
'Usage
Dim instance As IAdornerPlacement
public interface IAdornerPlacement
public interface class IAdornerPlacement
public interface IAdornerPlacement

Remarks

Placement terms are used to build up a set of values that provide flexibility in the positioning and sizing of adorners on an AdornerPanel.

Examples

The following code example shows how to set up placements for a rail adorner inside a control. For more information, see Walkthrough: Implementing a Rail Inside a Control.

' Place the slider in the adorner panel. 
Dim placement As New AdornerPlacementCollection()
AdornerPanel.SetHorizontalStretch(skewSlider, AdornerStretch.Stretch)
AdornerPanel.SetVerticalStretch(skewSlider, AdornerStretch.None)

' Use layout space for the adorner panel. 
' If render space were used, the slider would skew along with the button.
panel.CoordinateSpace = AdornerCoordinateSpaces.Layout

' The adorner's width is relative to the content. 
' The slider extends half the width of the control it adorns.
placement.SizeRelativeToContentWidth(0.5, 0)

' Center the adorner within the control.
placement.PositionRelativeToAdornerWidth(0.5, 0)

' The adorner's height is the same as the slider's.
placement.SizeRelativeToAdornerDesiredHeight(1.0, 0)

' Position the adorner within the control it adorns.
placement.PositionRelativeToAdornerHeight(1.0, 0)

AdornerPanel.SetPlacements(skewSlider, placement)
// Place the slider in the adorner panel.
AdornerPlacementCollection placement = new AdornerPlacementCollection();
AdornerPanel.SetHorizontalStretch(skewSlider, AdornerStretch.Stretch);
AdornerPanel.SetVerticalStretch(skewSlider, AdornerStretch.None);

// Use layout space for the adorner panel. 
// If render space were used, the slider would skew along with the button.
panel.CoordinateSpace = AdornerCoordinateSpaces.Layout;

// The adorner's width is relative to the content. 
// The slider extends half the width of the control it adorns.
placement.SizeRelativeToContentWidth(0.5, 0);

// Center the adorner within the control.
placement.PositionRelativeToAdornerWidth(0.5, 0);

// The adorner's height is the same as the slider's.
placement.SizeRelativeToAdornerDesiredHeight(1.0, 0);

// Position the adorner within the control it adorns.
placement.PositionRelativeToAdornerHeight(1.0, 0);

AdornerPanel.SetPlacements(skewSlider, placement);

See Also

Reference

IAdornerPlacement Members

Microsoft.Windows.Design.Interaction Namespace

AdornerPlacementCollection

AdornerPanel

Other Resources

Layout Space and Render Space

Walkthrough: Implementing a Rail Inside a Control

Understanding WPF Designer Extensibility