Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to get the Toggled State of Switch in Xamarin.Forms?

ksoluckyksolucky USMember ✭✭

I am using Switch in a Torch application and I want to identify when the switch is untoggled. I have used "torch.Toggled += switcher_Toggled;" to fire an event when the switch is toggled but how can I get the state when the switch is untoggled or disabled?


  • JulianPJulianP Member

    This should help:

     void switcher_Toggled(object sender, ToggledEventArgs e)
              //Do what you want to do!
  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    Aren't you binding its state to a property on your viewmodel? That's what you should be doing.
    If you're interogatting the UI for things like this then you're still in 1998. This isn't Windows Forms. You should be using MVVM patterns for your architecture.

Sign In or Register to comment.