DependencyObject
DependencyObject
DependencyObject
DependencyObject
Class
定義
依存関係プロパティ システムに参加しているオブジェクトを表します。Represents an object that participates in the dependency property system.
public ref class DependencyObject : System::Windows::Threading::DispatcherObject
[System.Windows.Markup.NameScopeProperty("NameScope", typeof(System.Windows.NameScope))]
public class DependencyObject : System.Windows.Threading.DispatcherObject
type DependencyObject = class
inherit DispatcherObject
Public Class DependencyObject
Inherits DispatcherObject
- 継承
-
DependencyObjectDependencyObjectDependencyObjectDependencyObject
- 派生
-
System.Windows.ContentElementSystem.Windows.ContentElementSystem.Windows.ContentElementSystem.Windows.ContentElementSystem.Windows.TriggerActionSystem.Windows.TriggerActionSystem.Windows.TriggerActionSystem.Windows.TriggerActionSystem.Windows.TriggerBaseSystem.Windows.TriggerBaseSystem.Windows.TriggerBaseSystem.Windows.TriggerBaseSystem.Windows.VisualStateSystem.Windows.VisualStateSystem.Windows.VisualStateSystem.Windows.VisualStateSystem.Windows.VisualStateGroupSystem.Windows.VisualStateGroupSystem.Windows.VisualStateGroupSystem.Windows.VisualStateGroupSystem.Windows.VisualStateManagerSystem.Windows.VisualStateManagerSystem.Windows.VisualStateManagerSystem.Windows.VisualStateManagerSystem.Windows.VisualTransitionSystem.Windows.VisualTransitionSystem.Windows.VisualTransitionSystem.Windows.VisualTransitionSystem.Windows.Controls.DataGridColumnSystem.Windows.Controls.DataGridColumnSystem.Windows.Controls.DataGridColumnSystem.Windows.Controls.DataGridColumnSystem.Windows.Controls.GridViewColumnSystem.Windows.Controls.GridViewColumnSystem.Windows.Controls.GridViewColumnSystem.Windows.Controls.GridViewColumnSystem.Windows.Controls.TextSearchSystem.Windows.Controls.TextSearchSystem.Windows.Controls.TextSearchSystem.Windows.Controls.TextSearchSystem.Windows.Controls.ViewBaseSystem.Windows.Controls.ViewBaseSystem.Windows.Controls.ViewBaseSystem.Windows.Controls.ViewBaseSystem.Windows.Controls.Ribbon.Primitives.StarLayoutInfoSystem.Windows.Controls.Ribbon.Primitives.StarLayoutInfoSystem.Windows.Controls.Ribbon.Primitives.StarLayoutInfoSystem.Windows.Controls.Ribbon.Primitives.StarLayoutInfoSystem.Windows.Data.BindingGroupSystem.Windows.Data.BindingGroupSystem.Windows.Data.BindingGroupSystem.Windows.Data.BindingGroupSystem.Windows.Data.CollectionContainerSystem.Windows.Data.CollectionContainerSystem.Windows.Data.CollectionContainerSystem.Windows.Data.CollectionContainerSystem.Windows.Data.CollectionViewSourceSystem.Windows.Data.CollectionViewSourceSystem.Windows.Data.CollectionViewSourceSystem.Windows.Data.CollectionViewSourceSystem.Windows.Ink.GestureRecognizerSystem.Windows.Ink.GestureRecognizerSystem.Windows.Ink.GestureRecognizerSystem.Windows.Ink.GestureRecognizerSystem.Windows.Input.InputBindingSystem.Windows.Input.InputBindingSystem.Windows.Input.InputBindingSystem.Windows.Input.InputBindingSystem.Windows.Media.VisualSystem.Windows.Media.VisualSystem.Windows.Media.VisualSystem.Windows.Media.VisualSystem.Windows.Media.Media3D.Visual3DSystem.Windows.Media.Media3D.Visual3DSystem.Windows.Media.Media3D.Visual3DSystem.Windows.Media.Media3D.Visual3D
- 属性
例
派生した次の例では、DependencyObject新しい抽象クラスを作成します。The following example derives from DependencyObject to create a new abstract class. クラスは、添付プロパティを登録し、その添付プロパティのサポート メンバーが含まれています。The class then registers an attached property and includes support members for that attached property.
public abstract class AquariumObject3 : DependencyObject
{
public enum Bouyancy
{
Floats,
Sinks,
Drifts
}
public static readonly DependencyProperty BouyancyProperty = DependencyProperty.RegisterAttached(
"Bouyancy",
typeof(Bouyancy),
typeof(AquariumObject3),
new FrameworkPropertyMetadata(Bouyancy.Floats, FrameworkPropertyMetadataOptions.AffectsArrange),
new ValidateValueCallback(ValidateBouyancy)
);
public static void SetBouyancy(UIElement element, Bouyancy value)
{
element.SetValue(BouyancyProperty, value);
}
public static Bouyancy GetBouyancy(UIElement element)
{
return (Bouyancy)element.GetValue(BouyancyProperty);
}
private static bool ValidateBouyancy(object value)
{
Bouyancy bTest = (Bouyancy) value;
return (bTest == Bouyancy.Floats || bTest == Bouyancy.Drifts || bTest==Bouyancy.Sinks);
}
public static readonly DependencyProperty IsDirtyProperty = DependencyProperty.Register(
"IsDirty",
typeof(Boolean),
typeof(AquariumObject3)
);
}
Public MustInherit Class AquariumObject3
Inherits DependencyObject
Public Enum Bouyancy
Floats
Sinks
Drifts
End Enum
Public Shared ReadOnly BouyancyProperty As DependencyProperty = DependencyProperty.RegisterAttached("Bouyancy", GetType(Bouyancy), GetType(AquariumObject3), New FrameworkPropertyMetadata(Bouyancy.Floats, FrameworkPropertyMetadataOptions.AffectsArrange), New ValidateValueCallback(AddressOf ValidateBouyancy))
Public Shared Sub SetBouyancy(ByVal element As UIElement, ByVal value As Bouyancy)
element.SetValue(BouyancyProperty, value)
End Sub
Public Shared Function GetBouyancy(ByVal element As UIElement) As Bouyancy
Return CType(element.GetValue(BouyancyProperty), Bouyancy)
End Function
Private Shared Function ValidateBouyancy(ByVal value As Object) As Boolean
Dim bTest As Bouyancy = CType(value, Bouyancy)
Return (bTest = Bouyancy.Floats OrElse bTest = Bouyancy.Drifts OrElse bTest = Bouyancy.Sinks)
End Function
Public Shared ReadOnly IsDirtyProperty As DependencyProperty = DependencyProperty.Register("IsDirty", GetType(Boolean), GetType(AquariumObject3))
End Class
注釈
DependencyObjectクラスによりWindows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)その派生クラスでプロパティ システム サービスです。The DependencyObject class enables Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) property system services on its many derived classes.
プロパティ システムの主な機能は、システム通知が変更された値を提供して、プロパティの値を計算するには。The property system's primary function is to compute the values of properties, and to provide system notification about values that have changed. プロパティ システムに参加している別のキー クラスはDependencyPropertyします。Another key class that participates in the property system is DependencyProperty. DependencyProperty プロパティ システムに依存関係プロパティの登録を有効し、は識別し、各依存関係プロパティに関する情報に対しDependencyObject基底クラスがオブジェクトの依存関係プロパティを使用することができます。DependencyProperty enables the registration of dependency properties into the property system, and provides identification and information about each dependency property, whereas DependencyObject as a base class enables objects to use the dependency properties.
DependencyObject 次のサービスと特性があります。DependencyObject services and characteristics include the following:
依存関係プロパティのサポートをホストします。Dependency property hosting support. 呼び出すことによって、依存関係プロパティを登録する、Registerメソッド、およびメソッドの戻り値をクラスにパブリックな静的フィールドとして保存します。You register a dependency property by calling the Register method, and storing the method's return value as a public static field in your class.
ホストのサポートされている添付プロパティ。Attached property hosting support. 呼び出して添付プロパティを登録する、RegisterAttachedメソッド、およびクラスのパブリック静的読み取り専用フィールドとしてメソッドの戻り値を格納します。You register an attached property by calling the RegisterAttached method, and storing the method's return value as a public static read-only field in your class. (メンバーの追加要件もあります。 これを表すことに注意してください、WPFWPF添付プロパティの特定の実装。(There are also additional member requirements; note that this represents a WPFWPF specific implementation for attached properties. 詳細については、次を参照してください添付プロパティの概要。)。派生したクラスで添付プロパティを設定できますDependencyObjectします。For details, see Attached Properties Overview.) Your attached property can then be set on any class that derives from DependencyObject.
取得、設定、およびユーティリティ メソッドの上に存在する依存関係プロパティの値をクリア、DependencyObjectします。Get, set, and clear utility methods for values of any dependency properties that exist on the DependencyObject.
メタデータは、値のサポート、プロパティ変更通知、および依存関係プロパティのオーバーライドのコールバックを強制または添付プロパティ。Metadata, coerce value support, property changed notification, and override callbacks for dependency properties or attached properties. また、DependencyObjectクラスに依存関係プロパティの所有者ごとのプロパティのメタデータが容易になります。Also, the DependencyObject class facilitates the per-owner property metadata for a dependency property.
クラスの共通基本クラスから派生したContentElement、 Freezable、またはVisualします。A common base class for classes derived from ContentElement, Freezable, or Visual. (UIElement、もう 1 つの基本要素クラスを含むクラス階層構造になってVisual)。(UIElement, another base element class, has a class hierarchy that includes Visual.)
コンストラクター
DependencyObject() DependencyObject() DependencyObject() DependencyObject() |
DependencyObject クラスの新しいインスタンスを初期化します。Initializes a new instance of the DependencyObject class. |
プロパティ
DependencyObjectType DependencyObjectType DependencyObjectType DependencyObjectType |
このインスタンスの CLRCLR 型をラップする DependencyObjectType を取得します。Gets the DependencyObjectType that wraps the CLRCLR type of this instance. |
Dispatcher Dispatcher Dispatcher Dispatcher |
この Dispatcher が関連付けられている DispatcherObject を取得します。Gets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject) |
IsSealed IsSealed IsSealed IsSealed |
このインスタンスが現在シールされている (読み取り専用である) かどうかを示す値を取得します。Gets a value that indicates whether this instance is currently sealed (read-only). |
メソッド
適用対象
こちらもご覧ください
フィードバック
お客様のご意見をお寄せください。 お寄せいただく内容の種類を選択:
このフィードバック システムは、GitHub Issues を利用して構築されています。 詳しくは、ブログをご覧ください。
フィードバックを読み込んでいます...