System.Windows.Controls


UIElementCollection クラス
UIElements の順序の付いたコレクションを表します。

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

構文

Visual Basic (宣言)
Public Class UIElementCollection
	Implements IList, ICollection, IEnumerable
Visual Basic (使用法)
Dim instance As UIElementCollection
C#
public class UIElementCollection : IList, ICollection, IEnumerable
C++
public ref class UIElementCollection : IList, ICollection, IEnumerable
J#
public class UIElementCollection implements IList, ICollection, 
	IEnumerable
JScript
public class UIElementCollection implements IList, ICollection, 
	IEnumerable
XAML
このマネージ クラスは XAML では使用できません。
解説

Panel 基本クラスでは、UIElementCollection を使用して子要素のコレクションが表されます。UIElementCollection で定義されるメソッドとプロパティは、Panel 子要素を操作するための共通機能セットを定義し、Panel から派生したすべてのオブジェクトに影響します。

UIElementCollection には、自身のコンテキスト (クラス) に対するアフィニティがあります。このコレクションへのアクセスは、このコレクションが属する Panel のコンテキストから行う必要があります。

使用例

Add メソッドを使用して、親 StackPanel に子コンテンツを追加する方法を次の例に示します。この作業には、UIElementCollection 型の Children プロパティを使用します。サンプル全体については、「要素の使用のサンプル」を参照してください。

C#
void AddButton(object sender, MouseButtonEventArgs e)
{
    sp1.Children.Clear();
    btn = new Button();
    btn.Content = "New Button";
    sp1.Children.Add(btn);
}
継承階層

System.Object
  System.Windows.Controls.UIElementCollection
スレッド セーフ

この型の public static (Visual Basicでは共有) メンバはすべて,スレッド セーフです。インスタンス メンバの場合は,スレッド セーフであるとは限りません。
プラットフォーム

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

バージョン情報

.NET Framework

サポート対象 : 3.0
参照

タグ :


Page view tracker