Created
October 10, 2014 02:49
-
-
Save cloudRoutine/0ac60348e1c532ae7f6c 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
namespace Scratch | |
open System | |
open System.Windows | |
open FsXaml | |
module ScratchModel = | |
type CustomQueryView = XAML<"CustomQuery.xaml"> | |
type CustomQuery() = | |
let cqv = new CustomQueryView() | |
let accessor = CustomQueryView.Accessor(cqv) | |
let root = accessor.ControlRoot | |
member val Root = root with get | |
member val Query = accessor.QueryBox.Text with get, set | |
member val ResultSource = accessor.ResultBox.ItemsSource with get, set | |
type WindowXAM = XAML<"ScratchWindow.xaml"> | |
let testList = ["list";"of";"test";"elements";"for";"the query";"box so";"we can see";"how";"well";"it works" ] | |
type ScratchWindow() = | |
let xaml_ui = new WindowXAM () | |
let root_ui = xaml_ui.CreateRoot () | |
let win = WindowXAM.Accessor ( root_ui ) | |
let window = win.WindowRoot | |
let mainPanel = win.StackTop | |
let QueryControl = CustomQuery() | |
do | |
QueryControl.ResultSource <- testList | |
mainPanel.Children.Add(QueryControl.Root) |> ignore | |
mainPanel.UpdateLayout() | |
member val Window = window with get | |
member val TopPanel = mainPanel with get | |
member this.Show() = | |
win.WindowRoot.Visibility <- Visibility.Visible | |
win.WindowRoot.Show() | |
member this.Hide() = | |
win.WindowRoot.Visibility <- Visibility.Hidden | |
let scratchwin = new ScratchWindow() | |
[<STAThread>] | |
do | |
let ScratchApp = new Application() | |
ScratchApp.Run( scratchwin.Window ) |> ignore |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment