![]() |
VOOZH | about |
dotnet add package FSharp.Windows.Dsl --version 0.3.0
NuGet\Install-Package FSharp.Windows.Dsl -Version 0.3.0
<PackageReference Include="FSharp.Windows.Dsl" Version="0.3.0" />
<PackageVersion Include="FSharp.Windows.Dsl" Version="0.3.0" />Directory.Packages.props
<PackageReference Include="FSharp.Windows.Dsl" />Project file
paket add FSharp.Windows.Dsl --version 0.3.0
#r "nuget: FSharp.Windows.Dsl, 0.3.0"
#:package FSharp.Windows.Dsl@0.3.0
#addin nuget:?package=FSharp.Windows.Dsl&version=0.3.0Install as a Cake Addin
#tool nuget:?package=FSharp.Windows.Dsl&version=0.3.0Install as a Cake Tool
A native F# DSL for WPF using the Elm architecture (MVU pattern). No XAML, no MVVM, no INotifyPropertyChanged — pure functions all the way down.
type Model = { Count: int }
type Msg = Increment | Decrement | Reset
let init () = { Count = 0 }, Cmd.none
let update msg model =
match msg with
| Increment -> { model with Count = model.Count + 1 }, Cmd.none
| Decrement -> { model with Count = model.Count - 1 }, Cmd.none
| Reset -> { Count = 0 }, Cmd.none
let view model dispatch =
window
[ Window.title $"Counter: {model.Count}"
Window.width 400.0
Window.height 300.0
Window.contentChild (
stackPanel
[ StackPanel.children
[ textBlock
[ TextBlock.text (string model.Count)
TextBlock.fontSize 48.0
TextBlock.horizontalAlignment HorizontalAlignment.Center ]
button
[ Button.content " + "
Button.onClick (RoutedEventHandler(fun _ _ -> dispatch Increment)) ]
button
[ Button.content " - "
Button.onClick (RoutedEventHandler(fun _ _ -> dispatch Decrement)) ] ] ]
) ]
[<STAThread; EntryPoint>]
let main _ =
Elmish.Program.mkProgram init update view |> Program.runWindow
The DSL replaces XAML bindings, ICommand, and ViewModelBase with the Elm loop:
init returns the initial modelview produces a virtual tree from the current model (pure function)update returns a new model in response to messages (pure function)dispatch connects user interactions back to the loopA reconciler diffs the old and new virtual trees and applies only the changes to the live WPF element tree. Event handlers are automatically refreshed on each render — no stale closures.
| Package | Description |
|---|---|
FSharp.Windows.Dsl |
Virtual tree, reconciler, hot reload, props |
FSharp.Windows.Dsl.Elmish |
Program.runWindow, Cmd extensions, components, AppBus |
FSharp.Windows.Dsl.Controls |
Generated WPF control wrappers |
FSharp.Windows.Dsl.Testing |
TestProgram, CmdTest, VirtualTree queries |
FSharp.Windows.Dsl.Codegen |
Reflection-based code generation tool |
dotnet build
dotnet run --project samples/ElmishCounter
| Sample | Description |
|---|---|
samples/HelloDsl |
Minimal DSL without Elmish |
samples/ElmishCounter |
Counter with components and child windows |
samples/LobForm |
Line-of-business form patterns |
samples/DevExpressDashboard |
DevExpress controls with Ribbon and AccordionControl |
Tests run without a WPF runtime — no STA thread, no window, no display server. view returns data. update is pure. Both are testable with zero infrastructure.
dotnet test
The codegen tool generates F# DSL wrappers for any WPF control library by reflecting over its assemblies. This works with DevExpress, Telerik, Syncfusion, and any other WPF control vendor.
Third-party control libraries like DevExpress, Telerik, and Syncfusion are licensed software. Their End User License Agreements (EULAs) typically restrict redistribution of their assemblies and derivative works. The generated F# wrappers reference these vendor types directly.
To comply with these restrictions, the generated wrappers are not included in this repository. Instead, each developer generates wrappers locally from their own licensed installation using the codegen tool.
This is not legal advice. You are responsible for reviewing and complying with the EULA of any third-party control library you use. Consult your vendor's license terms before distributing any generated code.
# Auto-detects your DevExpress installation and version
./tools/generate-devexpress.sh
This generates 26 product-area packages (Core, Grid, Ribbon, Charts, etc.) into vendor/FSharp.DevExpress.Wpf/. See for details.
Use the codegen tool directly:
dotnet run --project tools/Codegen -- \
--assembly YourVendor.Wpf.Controls \
--namespace FSharp.YourVendor.Wpf \
--output vendor/FSharp.YourVendor.Wpf/Generated/ \
--assembly-path "C:/path/to/vendor/dlls"
Specs are in docs/specs/ with numbered files organized by implementation phase. Start with .
dotnet build # build
dotnet test # run all tests
dotnet fantomas --check . # check F# formatting
dotnet fantomas . # fix F# formatting
See for the license of this project. Third-party control library wrappers you generate are subject to the EULA of the respective vendor.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 net8.0-windows7.0 is compatible. net9.0-windows net9.0-windows was computed. net9.0-windows7.0 net9.0-windows7.0 is compatible. net10.0-windows net10.0-windows was computed. net10.0-windows7.0 net10.0-windows7.0 is compatible. |
| .NET Framework | net461 net461 is compatible. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
Showing the top 3 NuGet packages that depend on FSharp.Windows.Dsl:
| Package | Downloads |
|---|---|
|
FSharp.Windows.Dsl.Controls
Generated WPF control wrappers for FSharp.Windows.Dsl |
|
|
FSharp.Windows.Dsl.Elmish
Elmish MVU integration for FSharp.Windows.Dsl |
|
|
FSharp.Windows.Dsl.Testing
Testing toolkit for FSharp.Windows.Dsl — TestProgram, CmdTest, VirtualTree queries |
This package is not used by any popular GitHub repositories.