次の方法で共有


AdornerPlacementCollection クラス

更新 : 2007 年 11 月

AdornerPanel 内の装飾の正確な配置を有効にします。

名前空間 :  Microsoft.Windows.Design.Interaction
アセンブリ :  Microsoft.Windows.Design.Interaction (Microsoft.Windows.Design.Interaction.dll 内)

構文

'宣言
Public Class AdornerPlacementCollection _
    Inherits ObservableCollection(Of IAdornerPlacement)
'使用
Dim instance As AdornerPlacementCollection
public class AdornerPlacementCollection : ObservableCollection<IAdornerPlacement>
public ref class AdornerPlacementCollection : public ObservableCollection<IAdornerPlacement^>
public class AdornerPlacementCollection extends ObservableCollection<IAdornerPlacement>

解説

装飾されるコントロールに対して相対的に AdornerPanel の位置、サイズ、およびスケーリングのプロパティを指定するには、AdornerPlacementCollection クラスを使用します。

PositionRelativeToAdornerHeight メソッドと PositionRelativeToAdornerWidth メソッドを呼び出すと、AdornerPanel は、その装飾コントロールの高さと幅に対して相対的に配置されます。

SizeRelativeToAdornerDesiredWidth メソッドと SizeRelativeToContentHeight メソッドを呼び出すと、AdornerPanel は、その装飾コントロールのサイズに対して相対的に配置されます。

装飾されるコンテンツに対して相対的に AdornerPanel のサイズと位置を指定するには、対応するコンテンツ ベースのメソッドを呼び出します。

サイズと位置を指定する各メソッドの呼び出しは累積されます。PositionRelativeToAdornerHeight メソッドの呼び出しを 2 回行うコード例を次に示します。この例では、装飾の高さに 5 ピクセルを加えた位置を y 軸のオフセットとして、装飾されるコントロールの上に AdornerPanel を配置します。

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

' Position the adorner up 5 pixels. This demonstrates 
' that these placement calls are additive. These two calls
' are equivalent to the following single call:
' PositionRelativeToAdornerHeight(-1.0, -5).
placement.PositionRelativeToAdornerHeight(0, -5)
// Position the adorner above the control it adorns.
placement.PositionRelativeToAdornerHeight(-1.0, 0);

// Position the adorner up 5 pixels. This demonstrates 
// that these placement calls are additive. These two calls
// are equivalent to the following single call:
// PositionRelativeToAdornerHeight(-1.0, -5).
placement.PositionRelativeToAdornerHeight(0, -5);

AdornerPlacementCollection を使用して、装飾パネル内の装飾の位置を指定する方法を次のコード例に示します。詳細については、「チュートリアル : デザイン時装飾の作成」を参照してください。

Dim placement As New AdornerPlacementCollection()

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

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

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

' Position the adorner up 5 pixels. This demonstrates 
' that these placement calls are additive. These two calls
' are equivalent to the following single call:
' PositionRelativeToAdornerHeight(-1.0, -5).
placement.PositionRelativeToAdornerHeight(0, -5)

AdornerPanel.SetPlacements(opacitySlider, placement)
AdornerPlacementCollection placement = new AdornerPlacementCollection();

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

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

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

// Position the adorner up 5 pixels. This demonstrates 
// that these placement calls are additive. These two calls
// are equivalent to the following single call:
// PositionRelativeToAdornerHeight(-1.0, -5).
placement.PositionRelativeToAdornerHeight(0, -5);

AdornerPanel.SetPlacements(opacitySlider, placement);

継承階層

System.Object
  System.Collections.ObjectModel.Collection<IAdornerPlacement>
    System.Collections.ObjectModel.ObservableCollection<IAdornerPlacement>
      Microsoft.Windows.Design.Interaction.AdornerPlacementCollection

スレッド セーフ

この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

参照

参照

AdornerPlacementCollection メンバ

Microsoft.Windows.Design.Interaction 名前空間

AdornerPanel

PrimarySelectionAdornerProvider

その他の技術情報

チュートリアル : デザイン時装飾の作成

チュートリアル : コントロール内でのレールの実装

装飾アーキテクチャ