Last active
July 1, 2016 15:20
-
-
Save bleis-tift/2a9f42ceed1e15af96af295417b1413a to your computer and use it in GitHub Desktop.
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
module main | |
open System | |
open FsXaml | |
type App = XAML<"App.xaml"> | |
[<STAThread>] | |
[<EntryPoint>] | |
let main argv = | |
App().Root.Run() |
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
<Application | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
StartupUri="MainWindow.xaml" | |
> | |
<Application.Resources> | |
</Application.Resources> | |
</Application> |
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
// Library1プロジェクト | |
namespace Library1 | |
open System.Windows | |
type Hoge () = | |
static let hogeProp = | |
DependencyProperty.RegisterAttached("Hoge", typeof<string>, typeof<Hoge>, PropertyMetadata("hoge")) | |
static member HogeProperty = hogeProp | |
static member GetHoge(obj: DependencyObject) = | |
obj.GetValue(Hoge.HogeProperty) :?> string | |
static member SetHoge(obj: DependencyObject, value: string) = | |
obj.SetValue(Hoge.HogeProperty, value) |
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
<Window | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:local="clr-namespace:ViewModels;assembly=FsEmptyWindowsApp1" | |
xmlns:hoge="clr-namespace:Library1;assembly=Library1" | |
xmlns:fsxaml="http://github.com/fsprojects/FsXaml" | |
Title="MVVM and XAML Type provider" Height="200" Width="400"> | |
<Window.DataContext> | |
<local:MainViewModel/> | |
</Window.DataContext> | |
<Grid> | |
<Button hoge:Hoge.Hoge="{Binding Text}">btn</Button> | |
</Grid> | |
</Window> |
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 | |
type MainViewModel() as self = | |
inherit ViewModelBase() | |
let text = self.Factory.Backing(<@ self.Text @>, "") | |
member __.Text with get () = text.Value and set (value) = text.Value <- value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment