0

I might be going completely wrong here but I am trying to perform 2 actions based on a single click of a ModernButton (Part of ModernUI).

Basically I have an 'Add' button on one page. When a user clicks it I want to call a 'Add' method on my underlying ViewModel and also navigate to a new view. I currently have this working from 2 separate buttons as a test but want them both working from one.

Example buttons:

<mui:ModernButton x:Name="btnAdd" Command="{Binding AddCommand}" CommandParameter="{Binding Project}"/>
<mui:ModernButton x:Name="btnAdd2" Command="NavigationCommands.GoToPage" CommandParameter="/View/pages/ProjectView.xaml"/>

I think I am getting confused as its a combination of 1 action on the UI and 1 on the ViewModel underneath.

It seems like a straightforward requirement which makes me think I may be going wrong in my approach.

As always, any help is very much appreciated.

Thanks.

MattR
  • 13
  • 4

1 Answers1

0

You can always copy the way Microsoft implements this problem, see the CompositeCommand, and either bind directly to this command, or create a multivalueconverter which takes multiple commands and returns a CompositeCommand.

myermian
  • 31,823
  • 24
  • 123
  • 215