SecondView.cs 979 B

12345678910111213141516171819202122232425262728293031323334
  1. using Cirrious.MvvmCross.Binding.BindingContext;
  2. using Cirrious.MvvmCross.Touch.Views;
  3. using CoreGraphics;
  4. using Foundation;
  5. using ObjCRuntime;
  6. using UIKit;
  7. namespace Xamarin_Insights.Iphone.Views
  8. {
  9. [Register("SecondView")]
  10. public class SecondView : MvxViewController
  11. {
  12. public override void ViewDidLoad()
  13. {
  14. View = new UIView {BackgroundColor = UIColor.White};
  15. base.ViewDidLoad();
  16. // ios7 layout
  17. if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
  18. {
  19. EdgesForExtendedLayout = UIRectEdge.None;
  20. }
  21. var button = new UIButton(new CGRect(10, 10, 300, 40));
  22. button.SetTitle("Go to Third", UIControlState.Normal);
  23. Add(button);
  24. var set = this.CreateBindingSet<SecondView, ViewModels.SecondViewModel>();
  25. set.Bind(button).To(vm => vm.GotoThirdViewCommand);
  26. set.Apply();
  27. }
  28. }
  29. }