summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/Switch.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Core/Switch.cs')
-rw-r--r--Xamarin.Forms.Core/Switch.cs14
1 files changed, 13 insertions, 1 deletions
diff --git a/Xamarin.Forms.Core/Switch.cs b/Xamarin.Forms.Core/Switch.cs
index 394e050a..73524b04 100644
--- a/Xamarin.Forms.Core/Switch.cs
+++ b/Xamarin.Forms.Core/Switch.cs
@@ -4,7 +4,7 @@ using Xamarin.Forms.Platform;
namespace Xamarin.Forms
{
[RenderWith(typeof(_SwitchRenderer))]
- public class Switch : View
+ public class Switch : View, IElementConfiguration<Switch>
{
public static readonly BindableProperty IsToggledProperty = BindableProperty.Create("IsToggled", typeof(bool), typeof(Switch), false, propertyChanged: (bindable, oldValue, newValue) =>
{
@@ -13,6 +13,13 @@ namespace Xamarin.Forms
eh(bindable, new ToggledEventArgs((bool)newValue));
}, defaultBindingMode: BindingMode.TwoWay);
+ readonly Lazy<PlatformConfigurationRegistry<Switch>> _platformConfigurationRegistry;
+
+ public Switch()
+ {
+ _platformConfigurationRegistry = new Lazy<PlatformConfigurationRegistry<Switch>>(() => new PlatformConfigurationRegistry<Switch>(this));
+ }
+
public bool IsToggled
{
get { return (bool)GetValue(IsToggledProperty); }
@@ -20,5 +27,10 @@ namespace Xamarin.Forms
}
public event EventHandler<ToggledEventArgs> Toggled;
+
+ public IPlatformElementConfiguration<T, Switch> On<T>() where T : IConfigPlatform
+ {
+ return _platformConfigurationRegistry.Value.On<T>();
+ }
}
} \ No newline at end of file