Skip to content

Instantly share code, notes, and snippets.

@FoggyFinder
FoggyFinder / Program.fs
Created May 13, 2020 13:47
FsharpAvaloniaSample
open Avalonia.Controls
open Avalonia.Layout
type MainWindow () as self =
inherit Window ()
let txb = TextBlock(Text = "F# Avalonia app",
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center)
type Data =
{ C : int[]
P : float[]
Values : int [][] }
module Tuple =
let mapPair f (x,y) = x |> f, y |> f
let swap (x,y) = y, x
let pairToArray (x,y) = [|x ; y |]
module Context =
open Gjallarhorn
open Gjallarhorn.Bindable
let rand = Random()
let choose n =
Array.sortBy (fun _ -> rand.Next()) [|0..10|]
let create () =
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fsxaml="http://github.com/fsprojects/FsXaml"
Title="MVVM and XAML Type provider"
Width="400"
Height="200">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />