FirstView.cs.pp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  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 $rootnamespace$.Views
  8. {
  9. [Register("FirstView")]
  10. public class FirstView : 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 label = new UILabel(new CGRect(10, 10, 300, 40));
  22. Add(label);
  23. var textField = new UITextField(new CGRect(10, 50, 300, 40));
  24. Add(textField);
  25. var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
  26. set.Bind(label).To(vm => vm.Hello);
  27. set.Bind(textField).To(vm => vm.Hello);
  28. set.Apply();
  29. }
  30. }
  31. }