简体   繁体   English

WPF命令绑定子级父级命令气泡

[英]WPF Command Binding Child Parent Command Bubble

WPF : I have an itemscontrol, and every item will have a close button. WPF:我有一个项目控件,并且每个项目都有一个关闭按钮。 I want to implement in such a way that when button is clicked, first it should call the corresponding command of item and then it shud call the command binding of parent. 我想以一种方式实现,当单击按钮时,首先应调用项目的相应命令,然后将其调用父项的命令绑定。 Basically bubble from child to parent but it should fire at both child and parent. 基本上是从孩子到父母的泡沫,但它应同时向孩子和父母触发。

This sounds like a job for a RoutedCommand. 这听起来像RoutedCommand的工作。 Josh Smith has a good explanation of how these work here: https://joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/ 乔什·史密斯(Josh Smith)很好地解释了这些方法的工作原理: https//joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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