简体   繁体   中英

What elements can block WPF dependency property inheritance?

My WPF App attaches a custom inherited dependency property (from a behavior) to my main application view. The idea is to pass this property (which never changes once the app is running) all the way down to some very nested controls that need it

<Window x:Class="MyApp.Views.MainWindow"
        core:SystemBehavior.SystemService="{Binding MySystem}"

It works well. So far, all of my controls have been able to access this data

<ComboBox ItemsSource="{Binding RelativeSource={RelativeSource Self}, 
                                Path=(core:SystemBehavior.SystemService).Units}"

But there's this ominous sentence in the MS documentation about Property Value Inheritance that gives me pause.

However, property value inheritance can bridge this gap in the logical tree and can still pass inherited values through, so long as the inheritable property was registered as an attached property and no deliberate inheritance-blocking boundary (such as a Frame) is encountered.

(emphasis added by me)

So my question is: What elements (besides a frame) can "block" dependency property inheritance?

I can't find any documentation that explicitly answers the question.

I searched referencesource.microsoft.com to come up with this list:

  • Frame
  • Page
  • DocumentReference
  • FixedPage
  • PageContent

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM