简体   繁体   中英

WPF Dependency Property Inheritance

I have a scenario in which DP Inheritance is not working, my code can also be wrong.

I have a Parent control with a bool Dependency Property "CanShow" on ViewModel. This enables/disables the button on this MainParent Window.

Now, I want a property/DP on child VM, which can set the CanShow property of Parent from childVM to enable/disable the button.

Is this a scenario for Dependency Property Inheritance? - Plz suggest.

I hope so, the scenario is clear.

Thanks,

VJ

No, inheritance does not work from child to parent, it works from parent to child. You will have to use some sort of event aggregation in order to propagate your event from child to parent which will change CanShow.

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