DependencyObject.ReadLocalValue(DependencyProperty) DependencyObject.ReadLocalValue(DependencyProperty) DependencyObject.ReadLocalValue(DependencyProperty) DependencyObject.ReadLocalValue(DependencyProperty) Method

定义

如果存在,则返回依赖属性的本地值。Returns the local value of a dependency property, if it exists.

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

参数

dp
DependencyProperty DependencyProperty DependencyProperty DependencyProperty

要为其检索值的属性的 DependencyProperty 标识符。The DependencyProperty identifier of the property to retrieve the value for.

返回

返回本地值,或在未设置本地值的情况下返回 sentinel 值 UnsetValueReturns the local value, or returns the sentinel value UnsetValue if no local value is set.

注解

应使用GetValue的依赖属性的最典型的"get"操作。You should use GetValue for most typical "get" operations for a dependency property. ReadLocalValue 不会返回很多情况的生效值的值未在本地设置。ReadLocalValue does not return the effective value for a variety of circumstances where the value was not locally set.

设置的样式、 主题和模板的值,从元数据或属性值继承的默认值是不被视为本地值。Values that are set by styles, themes, templates, the default value from metadata, or property value inheritance are not considered to be local values. 但是,被视为绑定和其他表达式将本地值,在之后进行计算。However, bindings and other expressions are considered to be local values, after they have been evaluated.

当没有本地值设置时,此方法返回UnsetValueWhen no local value is set, this method returns UnsetValue.

如果返回的值不是UnsetValue,可以查询的请求的依赖关系属性,以确定是否存在更具体的类型的返回值可以转换为元数据。If the returned value is other than UnsetValue, you can query the metadata of the requested dependency property to determine whether there is a more specific type that the return value can be converted to.

适用于

另请参阅