Created
December 1, 2014 03:14
-
-
Save dmohl/01d1448a902f2c6d83cc to your computer and use it in GitHub Desktop.
FsXaml ViewModel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ViewModels | |
open System | |
open System.Windows | |
open FSharp.ViewModule | |
open FSharp.ViewModule.Validation | |
open FsXaml | |
type MainView = XAML<"MainWindow.xaml", true> | |
type MainViewModel() as self = | |
inherit ViewModelBase() | |
let name = self.Factory.Backing(<@ self.Name @>, "") | |
let display = self.Factory.Backing(<@ self.Display @>, "") | |
let goCommand = self.Factory.CommandSyncParam(fun param -> self.Display <- sprintf "Your Name Is: %s" param) | |
member x.Name with get() = name.Value and set value = name.Value <- value | |
member x.Display with get() = display.Value and set value = display.Value <- value | |
member x.GoCommand = goCommand |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment