From ccc479215df693a58585daa9d82e05085c2139df Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Mon, 16 Jun 2014 10:16:00 +0300 Subject: [PATCH] Switch for Android listener added --- ui/switch/switch.android.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/switch/switch.android.ts b/ui/switch/switch.android.ts index c6b329bed..087337798 100644 --- a/ui/switch/switch.android.ts +++ b/ui/switch/switch.android.ts @@ -9,6 +9,14 @@ export class Switch extends view.View { constructor() { super(); this._android = new android.widget.Switch(application.android.currentContext); + + var that = this; + this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({ + onCheckedChanged: function (sender, isChecked) { + that.updateTwoWayBinding(Switch.checkedProperty, sender.isChecked()); + that.setProperty(Switch.checkedProperty, sender.isChecked()); + } + })); } get android(): android.widget.Switch {