Aplicativos do Windows
Recolher sumário
Expandir sumário
EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

DependencyObject.GetValue method

Returns the current effective value of a dependency property from a DependencyObject.

Syntax


public object GetValue(
  DependencyProperty dp
)

Parameters

dp

Type: DependencyProperty

The DependencyProperty identifier of the property for which to retrieve the value.

Return value

Type: System.Object [.NET] | Platform::Object [C++]

Returns the current effective value.

Remarks

GetValue obtains the current effective value of a dependency property. The current effective value is determined by using rules of Dependency properties overview.

GetValue is the API you want in most cases if you are using the property system APIs for obtaining property values. But sometimes you might want to examine other values to see how the dependency property precedence is acting for a given property. If so, you can use one of these APIs:

  • GetAnimationBaseValue to get values that might currently be animated but you want to know the value before the animation ran. Note that animations with HoldEnd behavior might not have this same value. For more info on the HoldEnd concept, see Storyboarded animations.
  • ReadLocalValue to get the local value, which does not have styles or templates or animations applied. Bindings do count as local values, but depending on when you call ReadLocalValue, the acting binding context might not be available yet, so you won't get the same value as would be applied at run time.

For more info on dependency property precedence and other property system utility API, see Dependency properties overview.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml
Windows::UI::Xaml [C++]

Metadata

Windows.winmd

See also

DependencyObject
SetValue
Custom dependency properties
Dependency properties overview

 

 

Mostrar:
© 2017 Microsoft