Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Commit

Permalink
Merge pull request #808 from ReedCopsey/fsxaml_update
Browse files Browse the repository at this point in the history
Updated to FsXaml 0.9.9
  • Loading branch information
dungpa committed Oct 30, 2014
2 parents 06ac111 + d5c0d9d commit 9a770f1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion paket.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ NUGET
Microsoft.AspNet.Razor (2.0.30506.0)
RazorEngine (3.3.0)
FSharp.ViewModule.Core (0.9.9.1)
FsXaml.Wpf (0.9.8)
FsXaml.Wpf (0.9.9)
Expression.Blend.Sdk (>= 1.0.2)
Microsoft.AspNet.Razor (2.0.30506.0)
Microsoft.Bcl (1.1.9)
Expand Down
19 changes: 8 additions & 11 deletions src/FSharpVSPowerTools.Logic/FolderMenuUI.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ open FSharpVSPowerTools
[<RequireQualifiedAccess>]
module FolderMenuUI =
let loadNewFolderDialog (viewModel: NewFolderNameDialogModel) =
let window = NewFolderNameDialog().CreateRoot()
window.DataContext <- viewModel
window
let window = NewFolderNameDialog()
window.Root.DataContext <- viewModel
window.Root

let loadMoveToFolderDialog (viewModel: MoveToFolderDialogModel) =
let window = MoveToFolderDialog().CreateRoot()
let window = MoveToFolderDialog()

// Provides access to "code behind" style work
let accessor = MoveToFolderDialog.Accessor(window)

accessor.FoldersTree.SelectedItemChanged.Add(fun _ ->
viewModel.SelectedFolder <- Some (accessor.FoldersTree.SelectedItem :?> Folder)
window.FoldersTree.SelectedItemChanged.Add(fun _ ->
viewModel.SelectedFolder <- Some (window.FoldersTree.SelectedItem :?> Folder)
)

window.DataContext <- viewModel
window
window.Root.DataContext <- viewModel
window.Root
2 changes: 1 addition & 1 deletion src/FSharpVSPowerTools.Logic/FolderNameDialog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open FSharpVSPowerTools
open FSharp.ViewModule
open FSharp.ViewModule.Validation

type NewFolderNameDialog = FsXaml.XAML< "FolderNameDialog.xaml" >
type NewFolderNameDialog = FsXaml.XAML<"FolderNameDialog.xaml">

[<NoEquality; NoComparison>]
type NewFolderNameDialogResources =
Expand Down
2 changes: 1 addition & 1 deletion src/FSharpVSPowerTools.Logic/MoveToFolderDialog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open FSharpVSPowerTools
open FSharp.ViewModule
open FSharp.ViewModule.Validation

type MoveToFolderDialog = FsXaml.XAML< "MoveToFolderDialog.xaml" >
type MoveToFolderDialog = FsXaml.XAML<"MoveToFolderDialog.xaml", ExposeNamedProperties=true>

type Folder =
{ Name: string
Expand Down
16 changes: 7 additions & 9 deletions src/FSharpVSPowerTools.Logic/RenameDialog.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ open FSharp.ViewModule.Progress
open FSharp.ViewModule.Validation
open System.Threading

type RenameDialog = FsXaml.XAML<"RenameDialog.xaml">
type RenameDialog = FsXaml.XAML<"RenameDialog.xaml", ExposeNamedProperties=true>

[<NoComparison>]
type RenameContext =
Expand Down Expand Up @@ -164,10 +164,8 @@ type RenameDialogViewModel(originalName: string, initialContext: Async<RenameCon

// This handles "code behind", ie: pure view logic for our dialog
type RenameDialogViewController() =
interface FsXaml.IViewController with
member __.Attach fe =
// Use the TypeProvider's Accessor sub-type to gain access to named members
let window = RenameDialog.Accessor fe
inherit FsXaml.WindowViewController<RenameDialog>()
override __.OnLoaded window =
let model = window.Root.DataContext :?> INotifyPropertyChanged
// Once the model is initialized, focus and select txtName so the user can just type "F2 / new_name / Enter"
model.PropertyChanged.Add(fun e ->
Expand All @@ -181,7 +179,7 @@ type RenameDialogViewController() =
[<RequireQualifiedAccess>]
module UI =
let loadRenameDialog (viewModel: RenameDialogViewModel) owner =
let window = RenameDialog().CreateRoot()
window.Owner <- owner
window.DataContext <- viewModel
window
let window = RenameDialog()
window.Root.Owner <- owner
window.Root.DataContext <- viewModel
window.Root

0 comments on commit 9a770f1

Please sign in to comment.