Skip to content

Instantly share code, notes, and snippets.

@slodge
Created May 22, 2013 08:17

Revisions

  1. slodge created this gist May 22, 2013.
    28 changes: 28 additions & 0 deletions FirstView
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    open System
    open System.Drawing
    open MonoTouch.UIKit
    open MonoTouch.Foundation
    open ReachingNirvana.Core
    open Cirrious.MvvmCross.Binding
    open Cirrious.MvvmCross.Binding.BindingContext
    open Cirrious.MvvmCross.Touch.Views

    [<Register ("FirstView")>]
    type FirstView () =
    inherit MvxViewController ()

    let label = new UILabel()
    let textBox = new UITextField()

    override this.ViewDidLoad () =
    base.ViewDidLoad ()

    label.Frame <- new RectangleF((float32)0,(float32)0,(float32)320,(float32)50)
    this.Add(label)
    textBox.Frame <- new RectangleF((float32)0,(float32)70,(float32)320,(float32)50)
    this.Add(textBox)

    let set = MvxBindingContextOwnerExtensions.CreateBindingSet<FirstView,FirstViewModel>(this)
    set.Bind(label).To("Hello") |> ignore
    set.Bind(textBox).To("Hello") |> ignore
    set.Apply()