VisualCollection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
Visual オブジェクトの順序付きコレクションを表します。
public ref class VisualCollection sealed : System::Collections::ICollection
public sealed class VisualCollection : System.Collections.ICollection
type VisualCollection = class
interface ICollection
interface IEnumerable
Public NotInheritable Class VisualCollection
Implements ICollection
- 継承
-
VisualCollection
- 実装
例
次の例は、 を作成してメンバーを VisualCollection 追加する方法を示しています。
// Create a host visual derived from the FrameworkElement class.
// This class provides layout, event handling, and container support for
// the child visual objects.
public class MyVisualHost : FrameworkElement
{
// Create a collection of child visual objects.
private VisualCollection _children;
public MyVisualHost()
{
_children = new VisualCollection(this);
_children.Add(CreateDrawingVisualRectangle());
_children.Add(CreateDrawingVisualText());
_children.Add(CreateDrawingVisualEllipses());
// Add the event handler for MouseLeftButtonUp.
this.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(MyVisualHost_MouseLeftButtonUp);
}
' Create a host visual derived from the FrameworkElement class.
' This class provides layout, event handling, and container support for
' the child visual objects.
Public Class MyVisualHost
Inherits FrameworkElement
' Create a collection of child visual objects.
Private _children As VisualCollection
Public Sub New()
_children = New VisualCollection(Me)
_children.Add(CreateDrawingVisualRectangle())
_children.Add(CreateDrawingVisualText())
_children.Add(CreateDrawingVisualEllipses())
' Add the event handler for MouseLeftButtonUp.
AddHandler MouseLeftButtonUp, AddressOf MyVisualHost_MouseLeftButtonUp
End Sub
注意
完全なサンプルについては、「 DrawingVisuals サンプルを使用したヒット テスト」を参照してください。
注釈
には VisualCollection 暗黙的なコンテキスト アフィニティがあります。 プロシージャが 所有ContainerVisualする のコンテキストとは異なるコンテキストから にアクセスVisualCollectionしようとすると、例外がスローされます。
コンストラクター
| VisualCollection(Visual) |
VisualCollection クラスの新しいインスタンスを初期化します。 |
プロパティ
| Capacity |
VisualCollection に格納できる要素の数を取得または設定します。 |
| Count |
コレクション内の要素の数を取得します。 |
| IsReadOnly |
VisualCollection が読み取り専用かどうかを示す値を取得します。 |
| IsSynchronized |
VisualCollection へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。 |
| Item[Int32] |
Visual の 0 から始まるインデックス位置に格納されている VisualCollection を取得または設定します。 |
| SyncRoot |
VisualCollection へのアクセスを同期するために使用できるオブジェクトを取得します。 |
メソッド
| Add(Visual) |
Visual を VisualCollection の末尾に追加します。 |
| Clear() |
VisualCollection からすべての要素を削除します。 |
| Contains(Visual) | |
| CopyTo(Array, Int32) |
指定した配列インデックスを開始位置として、コレクション内の項目を配列にコピーします。 |
| CopyTo(Visual[], Int32) |
渡された Visual 配列に現在のコレクションをコピーします。 |
| Equals(Object) |
指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。 (継承元 Object) |
| GetEnumerator() |
VisualCollection を反復処理できる列挙子を取得します。 |
| GetHashCode() |
既定のハッシュ関数として機能します。 (継承元 Object) |
| GetType() |
現在のインスタンスの Type を取得します。 (継承元 Object) |
| IndexOf(Visual) |
Visual の 0 から始まるインデックスを返します。 |
| Insert(Int32, Visual) |
VisualCollection 内の指定したインデックスの位置に要素を挿入します。 |
| MemberwiseClone() |
現在の Object の簡易コピーを作成します。 (継承元 Object) |
| Remove(Visual) |
指定した Visual オブジェクトを VisualCollection から削除します。 |
| RemoveAt(Int32) |
VisualCollection 内の指定したインデックス位置にあるビジュアル オブジェクトを削除します。 |
| RemoveRange(Int32, Int32) |
VisualCollection からビジュアル オブジェクトの範囲を削除します。 |
| ToString() |
現在のオブジェクトを表す文字列を返します。 (継承元 Object) |
明示的なインターフェイスの実装
| IEnumerable.GetEnumerator() |
このメンバーは WPF インフラストラクチャをサポートしており、コードから直接使用することを意図したものではありません。 このメンバーの詳細については、「GetEnumerator()」をご覧ください。 |
拡張メソッド
| Cast<TResult>(IEnumerable) |
IEnumerable の要素を、指定した型にキャストします。 |
| OfType<TResult>(IEnumerable) |
指定された型に基づいて IEnumerable の要素をフィルター処理します。 |
| AsParallel(IEnumerable) |
クエリの並列化を有効にします。 |
| AsQueryable(IEnumerable) |
IEnumerable を IQueryable に変換します。 |