10

Given a Visual Tree in WPF, it is possible to specify that AttachedProperties are inherited as follows:

public static class MyClass 
{
    public static readonly DependencyProperty FooProperty = 
        DependencyProperty.RegisterAttached(
            "Foo", typeof(string), typeof(MyClass),
            new FrameworkPropertyMetadata(
                "AString",
                FrameworkPropertyMetadataOptions.Inherits));
}

In UWP there is no FrameworkPropertyMetadata and hence you cannot specify FrameworkPropertyMetadataOptions.Inherits.

I had hoped the default behaviour would be to inherit DependencyProperty values but it is not.

Is there any equivalent in UWP to allow inheritance of DependencyProperty values?

Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178

0 Answers0