Open MovGP0 opened 7 years ago
it should be possible to bind Events to Commands in the ViewModel.
For controls that support command binding this is straight-forward:
<Button x:Name="SaveButton" Command="{x:Bind SaveCommand}" CommandParameter="{x:Bind Name= ... , Path= ..., Mode=OneWay}" />
Otherwise it requires triggers:
<Button x:Name="SaveButton"> <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <command:EventToCommand Command="{x:Bind SaveCommand}" CommandParameter="{x:Bind Name= ... , Path= ..., ... }" /> </i:EventTrigger> </i:Interaction.Triggers> </ListView>
There might also be an additional binding to make this simpler:
<Button x:Name="SaveButton" Click="{eb:Bind Command={x:Bind SaveCommand}, CommandParameter={x:Bind Name= ... , Path= ... , ...} }" />
Note: if you aren't familiar with compiled bindings (x:Bind instead of Binding), see Compiled Binding – What is it?
x:Bind
Binding
it should be possible to bind Events to Commands in the ViewModel.
For controls that support command binding this is straight-forward:
Otherwise it requires triggers:
There might also be an additional binding to make this simpler:
Note: if you aren't familiar with compiled bindings (
x:Bind
instead ofBinding
), see Compiled Binding – What is it?