IAdornerPlacement, interface

Mise à jour : novembre 2007

Spécifie un terme de positionnement pour un AdornerPlacementCollection.

Espace de noms :  Microsoft.Windows.Design.Interaction
Assembly :  Microsoft.Windows.Design.Interaction (dans Microsoft.Windows.Design.Interaction.dll)

Syntaxe

Public Interface IAdornerPlacement

Dim instance As IAdornerPlacement
public interface IAdornerPlacement
public interface class IAdornerPlacement
public interface IAdornerPlacement

Notes

Les termes de positionnement sont utilisés pour développer un jeu des valeurs qui fournissent la souplesse nécessaire dans le positionnement et le dimensionnement des ornements d'un AdornerPanel.

Exemples

L'exemple de code suivant indique comment installer des positionnements pour un ornement rail à l'intérieur d'un contrôle. Pour plus d'informations, consultez Procédure pas à pas : implémentation d'un rail à l'intérieur d'un contrôle.

' 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);

Voir aussi

Référence

Membres IAdornerPlacement

Microsoft.Windows.Design.Interaction, espace de noms

AdornerPlacementCollection

AdornerPanel

Autres ressources

Espace de disposition et espace de rendu

Procédure pas à pas : implémentation d'un rail à l'intérieur d'un contrôle

Fonctionnement de l'extensibilité du concepteur WPF