summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-06-16 09:45:09 -0600
committerRui Marinho <me@ruimarinho.net>2016-06-16 16:45:09 +0100
commitd5be2f0144ca810fdfbf59808d526c26fe86017e (patch)
tree3ad7e4465307cd6d633184e05d85eb3a4df59e01 /Xamarin.Forms.Platform.WP8/SwitchRenderer.cs
parent04f7bd296ee67af9189ecd7fdfbd2808ca16ce9a (diff)
downloadxamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.gz
xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.tar.bz2
xamarin-forms-d5be2f0144ca810fdfbf59808d526c26fe86017e.zip
Prep Page for removal of InternalsVisibleTo (#150)
Diffstat (limited to 'Xamarin.Forms.Platform.WP8/SwitchRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.WP8/SwitchRenderer.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs b/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs
index e64fe227..653cd0a6 100644
--- a/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs
+++ b/Xamarin.Forms.Platform.WP8/SwitchRenderer.cs
@@ -9,14 +9,16 @@ namespace Xamarin.Forms.Platform.WinPhone
{
readonly ToggleSwitchButton _toggleSwitch = new ToggleSwitchButton();
+ IElementController ElementController => Element as IElementController;
+
protected override void OnElementChanged(ElementChangedEventArgs<Switch> e)
{
base.OnElementChanged(e);
var container = new Border { Child = _toggleSwitch };
_toggleSwitch.IsChecked = Element.IsToggled;
- _toggleSwitch.Checked += (sender, args) => ((IElementController)Element).SetValueFromRenderer(Switch.IsToggledProperty, true);
- _toggleSwitch.Unchecked += (sender, args) => ((IElementController)Element).SetValueFromRenderer(Switch.IsToggledProperty, false);
+ _toggleSwitch.Checked += (sender, args) => ElementController.SetValueFromRenderer(Switch.IsToggledProperty, true);
+ _toggleSwitch.Unchecked += (sender, args) => ElementController.SetValueFromRenderer(Switch.IsToggledProperty, false);
_toggleSwitch.HorizontalAlignment = HorizontalAlignment.Right;
SetNativeControl(container);