Panel.Children プロパティ
この Panel の子要素の UIElementCollection を取得します。

名前空間: System.Windows.Controls
アセンブリ: PresentationFramework (presentationframework.dll 内)
XML 名前空間 :  http://schemas.microsoft.com/winfx/2006/xaml/presentation

構文

Visual Basic (宣言)
Public ReadOnly Property Children As UIElementCollection
Visual Basic (使用法)
Dim instance As Panel
Dim value As UIElementCollection

value = instance.Children
C#
public UIElementCollection Children { get; }
C++
public:
property UIElementCollection^ Children {
	UIElementCollection^ get ();
}
J#
/** @property */
public UIElementCollection get_Children ()
JScript
public function get Children () : UIElementCollection
XAML コンテンツ要素の使用
<object>
  <UIElementCollection .../>
</object>

プロパティ値

UIElementCollection。既定値は空の UIElementCollection です。
解説

コンテンツ モデル : Panel は、子コンテンツに強力なコンテンツ モデルを適用します。Panel 要素の Children コレクションを構成できるのは、UIElement オブジェクトだけです。UIElement の子を暗黙的に Panel に追加すると、Panel 要素の UIElementCollection に追加されます。

派生 Panel クラスではこのコレクションを使用せず、InternalChildren コレクションを使用してください。

このプロパティは、Panel がデータ バインドされている場合は null 参照 (Visual Basic では Nothing) を返します。

使用例

Children プロパティを使用して UIElement の子を Panel 要素に追加する方法を次のコード例に示します。

C#
StackPanel myStackPanel = new StackPanel();
Button myButton = new Button();
myButton.Content = "Press me";
myStackPanel.Children.Add(myButton);
プラットフォーム

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0
参照

タグ :


Page view tracker