Frage

I got a ShellViewModel with multiple sub views (and viewmodels). A sub view can bind to a method in the ShellViewModel easyly with Message.Attach. It bubbles up. But can I "bubble down" so the ShellViewModel triggers a method in a sub ViewModel or even from one sub view up and then down to another one?

AFAIK I could use EventAggregator but is it the most elegant way?

War es hilfreich?

Lösung

I believe, there is no such thing as "bubble down". But, you can use Bind.ModelWithoutContext to move action target to your child ViewModel:

<Button cal:Message.Attach="DoIt" cal:Bind.ModelWithoutContext="{Binding Path=ChildViewModel}" Content="Test It!"/>

There is "some" documentation on https://caliburnmicro.codeplex.com/wikipage?title=All%20About%20Actions. Hope it will help you.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top