diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Android/Cells/SwitchCellRenderer.cs')
-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); |