This is a migrated thread and some comments may be shown as answers.

Shouldn't UI Switch have an event?

4 Answers 60 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 12 Mar 2015, 01:48 PM
http://docs.nativescript.org/ApiReference/ui/switch/Switch

Why is there no event to hook into for the switch, should be be using like tap or something instead?

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 13 Mar 2015, 08:25 AM
Hello Steve,

Can you provide more info about your case? Generally you can bind checked property of the Switch to a property in your view model. 

Regards,
Vlad
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 13 Mar 2015, 08:44 AM
It is indeed already bound...I just wanted to save the data when the user toggles it.
0
Vlad
Telerik team
answered on 13 Mar 2015, 08:56 AM
Hello,

In this case you can execute the code from the property setter of the your view model property. In this case you will have complete separation between the UI and your business logic and will avoid any problems related to events like coupling and possible memory leaks. 

Regards,
Vlad
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 13 Mar 2015, 01:14 PM
Okay good call!  
Tags
General Discussions
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Vlad
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or