更新 : 2007 年 11 月
デザイン時に装飾として使用される Windows Presentation foundation (WPF) コントロールのコンテナを提供します。
名前空間 : Microsoft.Windows.Design.Interaction
アセンブリ : Microsoft.Windows.Design.Interaction (Microsoft.Windows.Design.Interaction.dll 内)
構文
'宣言
Public Class AdornerPanel _
Inherits Panel
'使用
Dim instance As AdornerPanel
public class AdornerPanel : Panel
public ref class AdornerPanel : public Panel
public class AdornerPanel extends Panel
解説
デザイン時の装飾を格納するには、AdornerPanel クラスを使用します。装飾とは、別のユーザー インターフェイス (UI: User Interface) を装飾する UI です。
装飾を表すコントロールは、Children コレクションに追加します。
装飾されるコントロールに対して相対的に装飾のサイズを指定するには、SetHorizontalStretch メソッドと SetVerticalStretch メソッドを呼び出します。
装飾のサイズと位置を指定するには、AdornerPlacementCollection を作成し、サイズおよび位置に関連するメソッドを呼び出します。SetPlacements メソッドを使用して、AdornerPlacementCollection を装飾パネルに追加します。
装飾パネルをセットアップしたら、それを AdornerProvider 実装の Adorners コレクションに追加します。
装飾は、Tool 添付プロパティを通じてツール コマンドにバインドされます。マウスが装飾の上を移動するときには、装飾のバインディングが、入力とコマンドのルーティングの一部として使用されます。また、装飾される UI 要素に関連付けられているモデルは、装飾がアクティブな場合に生成されるジェスチャ データの "ソース" 値になります。
例
AdornerPanel を使用して、装飾されるコントロールの Background プロパティを設定するためにデザイン時に使用される Slider コントロールをホストする方法を次のコード例に示します。詳細については、「チュートリアル : デザイン時装飾の作成」を参照してください。
' Setup the adorner panel.
' All adorners are placed in an AdornerPanel
' for sizing and layout support.
Dim myPanel = Me.Panel
AdornerPanel.SetHorizontalStretch(opacitySlider, AdornerStretch.Stretch)
AdornerPanel.SetVerticalStretch(opacitySlider, AdornerStretch.None)
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)
// Setup the adorner panel.
// All adorners are placed in an AdornerPanel
// for sizing and layout support.
AdornerPanel myPanel = this.Panel;
AdornerPanel.SetHorizontalStretch(opacitySlider, AdornerStretch.Stretch);
AdornerPanel.SetVerticalStretch(opacitySlider, AdornerStretch.None);
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.Windows.Threading.DispatcherObject
System.Windows.DependencyObject
System.Windows.Media.Visual
System.Windows.UIElement
System.Windows.FrameworkElement
System.Windows.Controls.Panel
Microsoft.Windows.Design.Interaction.AdornerPanel
スレッド セーフ
この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
参照
参照
Microsoft.Windows.Design.Interaction 名前空間