我有一个带有多个子视图(和视图模型)的ShellViewModel。子视图可以使用Message.Attach轻松绑定到ShellViewModel中的方法。起泡。但是我是否可以“冒泡”,以便ShellViewModel在子ViewModel中甚至在一个子视图中触发一个方法,然后再向下触发另一个方法?
AFAIK我可以使用EventAggregator,但这是最优雅的方法吗?
我相信,没有“冒泡”之类的东西。但是,您可以使用Bind.ModelWithoutContext将操作目标移至子ViewModel:
<Button cal:Message.Attach="DoIt" cal:Bind.ModelWithoutContext="{Binding Path=ChildViewModel}" Content="Test It!"/>
https://caliburnmicro.codeplex.com/wikipage?title=All%20About%20Actions上有一些“文档” 。希望对您有帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句