Skip to content

Instantly share code, notes, and snippets.

@teyc
Last active June 19, 2020 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teyc/cb59c648b7b0c8de6a100ae77fd69263 to your computer and use it in GitHub Desktop.
Save teyc/cb59c648b7b0c8de6a100ae77fd69263 to your computer and use it in GitHub Desktop.
F# Core and WPF

Hello World WPF for F# on .NET Core 3.1

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FsWpf"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWPF>true</UseWPF>
<Language>F#</Language>
<UseStandardResourceNames>true</UseStandardResourceNames>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
<Page Remove="*.xaml" />
<Resource Include="*.xaml" />
</ItemGroup>
</Project>
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FsWpf"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<TextBlock>Hello World</TextBlock>
</Grid>
</Window>
open System
open System.Windows
[<STAThread>]
[<EntryPoint>]
let main _ =
let application = Application.LoadComponent (Uri("App.xaml", UriKind.Relative)) :?> Application
application.Run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment