![](/img/trans.png)
[英]When using a DependencyProperty, how can I tell the the difference between an inherited value and an assigned one
[英]When using a dependency property in uwp, how can I tell the difference between default value and assigned value
在 uwp 中使用依赖属性时,如何区分默认值和分配值
我已经在 wpf 的 dependencypropertyhelper 中使用了这种情况,但这不可用 uwp。
任何人都可以在 uwp 中分享解决方案吗?
您可以将ReadValue
方法返回的值与DependencyProperty.UnsetValue
进行比较,例如:
TextBlock textBlock = new TextBlock();
if (textBlock.ReadLocalValue(TextBlock.TextProperty) == DependencyProperty.UnsetValue)
{
//property not set...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.