Shouldn't UI Switch have an event?

Thread is closed for posting
5 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 12 Mar 2015 Link to this post

    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?
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 13 Mar 2015 Link to this post

    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.

     
  3. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 13 Mar 2015 in reply to Vlad Link to this post

    It is indeed already bound...I just wanted to save the data when the user toggles it.
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 13 Mar 2015 Link to this post

    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.

     
  5. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 13 Mar 2015 in reply to Vlad Link to this post

    Okay good call!  
Back to Top