public override void LoadView() { base.LoadView(); _CustomView = new XMCustomView(); // This is the custom event we bound. // This is sometimes preferable to specifying a delegate. _CustomView.ViewWasTouched += Handle_CustomViewViewWasTouched; // The XMCustomViewDelegate we bound // If we specify this it will OVERRIDE the event handler we specified // _CustomView.Delegate = new CustomViewDelegate(); // The XMCustomView Name Property _CustomView.Name = @"Anuj"; // The instance method uses a frame calculation. _CustomView.Frame = new RectangleF(10, 25, 200, 200); // The instance method we bound. _CustomView.CustomizeViewWithText(string.Format(@"Yo {0}, I hurd you like bindings! MonoTouch makes it super easy with BTOUCH. Try it out!", _CustomView.Name ?? "Dawg")); var section = new Section("Custom View") { new CustomViewElement(_CustomView), }; this.Root.Add(section); }
public override void LoadView() { base.LoadView(); customView = new XMCustomView { // The XMCustomView Name Property Name = "Xamarin User", // The instance method uses a frame calculation. Frame = new CGRect(10, 10, View.Bounds.Width - 40, 150), }; // This is the custom event we bound. // This is sometimes preferable to specifying a delegate. customView.ViewWasTouched += Handle_CustomViewViewWasTouched; // The XMCustomViewDelegate we bound // If we specify this it will OVERRIDE the event handler we specified // customView.Delegate = new CustomViewDelegate(); // The instance method we bound. customView.CustomizeView($"Yo {customView.Name}, I heard you like bindings! Xamarin makes it super easy with binding projects. Try it out!"); Root.Add(new[] { new Section("Custom View") { new UIViewElement("", customView, true, new UIEdgeInsets(0, 0, 40, 40)), }, new Section("Operations") { new StringElement("Use Event", Handle_UseEvent), new StringElement("Use Delegate", Handle_UseDelegate), new StringElement("Do Touch", Handle_DoTouchOperation), } }); }
public override void ViewWasTouched(XMCustomView view) { Console.WriteLine("Hey! Our XMCustomView was touched with frame: {0}!", view.Frame); }
public abstract void ViewWasTouched (XMCustomView view);
public override void ViewWasTouched(XMCustomView view) { viewController.Handle_ViewTouched("DELEGATE"); }