I’m trying to save the result from a ToggleSwitch (True/False) back to my Azure Database through a WCF. Within the database, the datatype is set to int.
Is that correct so far?
Then I dont know what follows the toggle1. part of this code, eg:
private void addPersonBtn_Click(object sender, RoutedEventArgs e)
{
_ServiceClient.AddPersonAsync(fnameTxtBox.Text, snameTxtBox.Text, toggle1.XXX, toggle2.XXX);
}
Again, what would go here – unfortunately its not limiting it to a few options, but quite a long list on the autocomplete.
Any help would be great.
Thanks,
The
IsCheckedproperty is what you’re looking for. It’s a boolean (bool?, orNullable<bool>) value you can use to indicate whether the switch is checked.If your method signature takes
bool, you can usetoggle1.IsChecked.GetValueOrDefault(), to get the checked state, orfalseif the value isnull. I’m almost positiveToggleSwitchwill always have a true/false value, though.