I have a command in a view model called Add and it currently takes in one parameter called Result. I now need more data passed into the command and that is the IsToggled property value of the Switch control.
So if I have the following class:
public class ResultData
{
public string Result { get; set; }
public bool IsToggled { get; set; }
}
And a snippet of the XAML in question:
<Switch IsToggled="false" ThumbColor="Black" OnColor="LimeGreen" HorizontalOptions="End" VerticalOptions="Center" >
<Switch.Behaviors>
<behaviours:EventToCommandBehavior EventName="Toggled"
Command="{Binding BindingContext.Add, Source={x:Reference
MyPageContent}}"
CommandParameter="{Binding Result}" />
</Switch.Behaviors>
</Switch>
What is the XAML syntax to pass Result & IsToggled using the CommandParameter? I am open to other approaches if you feel that this not the right way to do it.