在WPF中给定一个Visual Tree,可以指定AttachedProperties继承如下:
public static class MyClass
{
public static readonly DependencyProperty FooProperty =
DependencyProperty.RegisterAttached(
"Foo", typeof(string), typeof(MyClass),
new FrameworkPropertyMetadata(
"AString",
FrameworkPropertyMetadataOptions.Inherits));
}
在UWP中没有FrameworkPropertyMetadata,因此您无法指定FrameworkPropertyMetadataOptions.Inherits。
我曾希望默认行为是继承DependencyProperty值,但事实并非如此。
UWP中是否有任何等价物允许继承DependencyProperty 值?