diff options
author | Samantha Houts <samantha@teamredwall.com> | 2016-04-07 05:30:13 -0700 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2016-04-07 13:30:13 +0100 |
commit | bb7bf53447538d5f17cac48052585a6a9282f70b (patch) | |
tree | 826a599e2ca665c41e4bfdf4b36d293db4a2ed00 /Xamarin.Forms.Platform.Android/Cells | |
parent | c98d338e15a29897e3a9a9d03d30dd3c70347925 (diff) | |
download | xamarin-forms-bb7bf53447538d5f17cac48052585a6a9282f70b.tar.gz xamarin-forms-bb7bf53447538d5f17cac48052585a6a9282f70b.tar.bz2 xamarin-forms-bb7bf53447538d5f17cac48052585a6a9282f70b.zip |
Merge pull request #45 from xamarin/fix-bugzilla25662
[A] SwitchCell IsEnabled bit now affects the toggle
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Cells')
-rw-r--r-- | Xamarin.Forms.Platform.Android/Cells/SwitchCellRenderer.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.Android/Cells/SwitchCellRenderer.cs b/Xamarin.Forms.Platform.Android/Cells/SwitchCellRenderer.cs index bba9d260..f2ea5cc3 100644 --- a/Xamarin.Forms.Platform.Android/Cells/SwitchCellRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Cells/SwitchCellRenderer.cs @@ -23,6 +23,7 @@ namespace Xamarin.Forms.Platform.Android UpdateText(); UpdateChecked(); UpdateHeight(); + UpdateIsEnabled(_view, cell); return _view; } @@ -35,6 +36,8 @@ namespace Xamarin.Forms.Platform.Android UpdateChecked(); else if (args.PropertyName == "RenderHeight") UpdateHeight(); + else if (args.PropertyName == Cell.IsEnabledProperty.PropertyName) + UpdateIsEnabled(_view, (SwitchCell)sender); } void UpdateChecked() @@ -42,6 +45,14 @@ namespace Xamarin.Forms.Platform.Android ((ASwitch)_view.AccessoryView).Checked = ((SwitchCell)Cell).On; } + void UpdateIsEnabled(SwitchCellView cell, SwitchCell switchCell) + { + cell.Enabled = switchCell.IsEnabled; + var aSwitch = cell.AccessoryView as ASwitch; + if (aSwitch != null) + aSwitch.Enabled = switchCell.IsEnabled; + } + void UpdateHeight() { _view.SetRenderHeight(Cell.RenderHeight); |