diff options
Diffstat (limited to 'Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs')
-rw-r--r-- | Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs | 61 |
1 files changed, 48 insertions, 13 deletions
diff --git a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs index 3eb36bfc..71c5e0c6 100644 --- a/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs +++ b/Xamarin.Forms.ControlGallery.iOS/AppDelegate.cs @@ -156,7 +156,7 @@ namespace Xamarin.Forms.ControlGallery.iOS MessagingCenter.Subscribe<Bugzilla40911>(this, Bugzilla40911.ReadyToSetUp40911Test, SetUp40911Test); // When the native binding gallery loads up, it'll let us know so we can set up the native bindings - MessagingCenter.Subscribe<NativeBindingGalleryPage >(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings); + MessagingCenter.Subscribe<NativeBindingGalleryPage>(this, NativeBindingGalleryPage.ReadyForNativeBindingsMessage, AddNativeBindings); LoadApplication(app); return base.FinishedLaunching(uiApplication, launchOptions); @@ -297,6 +297,12 @@ namespace Xamarin.Forms.ControlGallery.iOS uilabel.SetBinding("Text", new Binding("NativeLabel")); uilabel.SetBinding(nameof(uilabel.TextColor), new Binding("NativeLabelColor", converter: nativeColorConverter)); + var kvoSlider = new KVOUISlider(); + kvoSlider.MaxValue = 100; + kvoSlider.MinValue = 0; + kvoSlider.SetBinding(nameof(kvoSlider.KVOValue), new Binding("Age", BindingMode.TwoWay)); + sl?.Children.Add(kvoSlider); + var uiView = new UIView(new RectangleF(0, 0, width, heightCustomLabelView)); uiView.Add(uilabel); sl?.Children.Add(uiView); @@ -321,32 +327,61 @@ namespace Xamarin.Forms.ControlGallery.iOS page.Layout.Children.Add(button); } - public void StartPressed40911 () - { + public void StartPressed40911() + { var loginViewController = new UIViewController { View = { BackgroundColor = UIColor.White } }; - var button = UIButton.FromType (UIButtonType.RoundedRect); - button.SetTitle ("Login", UIControlState.Normal); - button.Frame = new CGRect (20, 100, 200, 44); - loginViewController.View.AddSubview (button); - - button.TouchUpInside += (sender, e) => { - Xamarin.Forms.Application.Current.MainPage = new ContentPage {Content = new Label {Text = "40911 Success"} }; - loginViewController.DismissViewController (true, null); + var button = UIButton.FromType(UIButtonType.RoundedRect); + button.SetTitle("Login", UIControlState.Normal); + button.Frame = new CGRect(20, 100, 200, 44); + loginViewController.View.AddSubview(button); + + button.TouchUpInside += (sender, e) => + { + Xamarin.Forms.Application.Current.MainPage = new ContentPage { Content = new Label { Text = "40911 Success" } }; + loginViewController.DismissViewController(true, null); }; - var window= UIApplication.SharedApplication.KeyWindow; + var window = UIApplication.SharedApplication.KeyWindow; var vc = window.RootViewController; while (vc.PresentedViewController != null) { vc = vc.PresentedViewController; } - vc.PresentViewController (loginViewController, true, null); + vc.PresentViewController(loginViewController, true, null); } #endregion } + [Register("KVOUISlider")] + public class KVOUISlider : UISlider + { + + public KVOUISlider() + { + ValueChanged += (s, e) => KVOValue = Value; + } + + float _kVOValue; + [Export("kvovalue")] + public float KVOValue + { + get + { + + return _kVOValue; + } + set + { + + WillChangeValue(nameof(KVOValue).ToLower()); + _kVOValue = Value = value; + DidChangeValue(nameof(KVOValue).ToLower()); + } + } + } + public class ColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |