DependencyObject.GetValue(DependencyProperty) DependencyObject.GetValue(DependencyProperty) DependencyObject.GetValue(DependencyProperty) DependencyObject.GetValue(DependencyProperty) Method

定義

傳回 DependencyObject 的這個執行個體上之相依性屬性的目前有效值。Returns the current effective value of a dependency property on this instance of a DependencyObject.

public:
 System::Object ^ GetValue(System::Windows::DependencyProperty ^ dp);
public object GetValue (System.Windows.DependencyProperty dp);
member this.GetValue : System.Windows.DependencyProperty -> obj
Public Function GetValue (dp As DependencyProperty) As Object

參數

dp
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

要為其擷取值之屬性的 DependencyProperty 識別項。The DependencyProperty identifier of the property to retrieve the value for.

傳回

傳回目前的有效值。Returns the current effective value.

例外狀況

指定的 dp 或其值無效,或是指定的 dp 不存在。The specified dp or its value was invalid, or the specified dp does not exist.

備註

有效值要求值的任何呼叫屬性系統所傳回之屬性的值。The effective value is the value of the property that is returned by the property system to any caller that is requesting the value. 有效的值是屬性系統在評估所有可能的輸入屬性的系統值優先順序中,參與的結果。The effective value is the result of the property system having evaluated all the possible inputs that participate in the property system value precedence. 這包括強制型轉和動畫。This includes coercion and animation. 如需詳細資訊,請參閱相依性屬性值優先順序For more information, see Dependency Property Value Precedence.

這個方法永遠不會傳回UnsetValueThis method will never return UnsetValue. UnsetValue是屬性系統,用於在內部,偶爾會也強制型轉回撥透過公開的各種容量的 sentinel 值。The UnsetValue is a sentinel value for the property system that is used in various capacities internally and occasionally also exposed through coercion callbacks.

如果您不確定屬性的類型應該是什麼,您可以查詢以判斷是否有更多的特定要求的相依性屬性的識別項PropertyType傳回的值可以轉換成。If you are not sure what the property's type should be, you can query the identifier of the requested dependency property to determine whether there is a more specific PropertyType that the return value can be converted to.

適用於

另請參閱