Search code examples
windows-phone-8windows-phone-toolkitischeckedtoggleswitch

setting state of windows phone toolkit toggle switch


I'm working on a windows phone 8 application. I want to use toggle switch for some purposes. Sadly windows phone 8 does not have that controller. So i had to install windows phone toolkit nuget package.

Now I want to set the state(some thing like isChecked=true). but I couldn't find any method to use. can someone please help me.


Solution

  • Try this on Button Click

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        if (toggleSwitch.IsChecked == true)
            toggleSwitch.IsChecked = false;
        else
            toggleSwitch.IsChecked = true;
    }
    

    It is Working....