Snippets tagged wpf

  • Load XAML

    This example shows how to load a Xaml file allowing to use WPF from F#. It also shows how to access WPF objects and register event handlers.

    104 people like this

    Posted: 8 years ago by Antonio Cisternino

  • ObservableObject

    The ObservableObject type implements the INotifyPropertyChanged interface used in WPF and Silverlight to notify on changes to properties that are bound to a control. Specify property names type safely using F# Quotations, i.e. <@ this.PropertyName @> when invoking the NotifyPropertyChanged method. If you are following the MVVM pattern then your View Model class can inherit from the ObservableObject type.

    59 people like this

    Posted: 7 years ago by Phillip Trelford

  • WPF DepdencyProperty

    Declaring WPF DependencyProperty in F#

    21 people like this

    Posted: 7 years ago by Fahad

  • A fun-ny WPF DataTemplate DSL

    Parts of a little DSL to create WPF DataTemplate's in F#. Don't even want to think about the length of a corresponding C#. The F# code corresponds 1-to-1 to the visual tree constructed for the template.

    7 people like this

    Posted: 7 years ago by Cetin Sert

  • WPF / SilverLight Converter II

    version 1 is This new version support convert from any existing function to a converter function by using composition and pipeline. The convert function is to make the function signature agree to the IValueConverter interface. You can add new functions in the FunctionLibrary module and reuse the class definition to reduce the coding effort. The first sample is to show how to make the converter pipeline work, the second one is a debugger converter used to debug the data binding problem.

    83 people like this

    Posted: 7 years ago by Tao Liu

  • Drag move for GUI controls

    This script opens a window with a red rectangle which is moved by dragging. I like writing interactive GUI without MVVM, FRP and Markup language.

    7 people like this

    Posted: 7 years ago by nagat01

  • Sierpinski triangle, WPF

    Draws a Sierpinski triangle using WPF

    12 people like this

    Posted: 6 years ago by Mathias Brandewinder

  • Example of Elm-like immutable MVVM

    An example of a simple ViewModel for WPF inspired by the "immutable" Elm Architecture - It is just an proof of concept. See the library code and a few working examples at

    6 people like this

    Posted: 2 years ago by Zdenek Pavlis

  • WPF async access.

    Computation builder for async access.

    1 people like this

    Posted: 1 year ago by Zhukoff Dima

  • Draw ellipses on WPF on button click

    Can be run in interactive or compiled with FSC. Cobbled together from various other snippets :)

    3 people like this

    Posted: 9 months ago by asdf

  • FSX Structure

    I use this basic template when writing .fsx files that I might want to compile. It adjusts the difference in command line/entrypoint handling between a script and a compiled assembly. This example shows the details for a WPF script — replace the #r's and/or remove the STAThread for a WinForms or Console script.

    117 people like this

    Posted: 8 years ago by Blake Coverett

  • WPF Custom Control

    This snippet shows how to create a WPF custom control library in F#.

    43 people like this

    Posted: 7 years ago by Fahad

  • F# Quotations with INotifyPropertyChanged

    ViewModelBase for F# users who want to use it in WPF / Silverlight

    15 people like this

    Posted: 7 years ago by Fahad

  • WPF/Silverlight Value Converter

    Example of a WPF/Silverlight Value Converter base class and concrete implementation.

    6 people like this

    Posted: 7 years ago by Tao Liu and Daniel Mohl

  • Building a WPF application in functional way

    I started to write pure F# + WPF application in about half a year ago. Today, I found a good way to compose WPF controls with dependent values. It's only writing a dependency object type as a class and give it to constructors of GUI controls. In this snippet "Volume","ColorVolume" and "ShapeContainer" has no properties. But works as a View which represents internal Model and allows users to change internal data. You only need calling a constructor of them. It means that you can compose GUI controls and it's functionality as a immutable data structure. (Update 2011/12/02 8:33:00(UTC+09:00) : Removed some user defined operators and renamed a type similar to DependencyObject in this snippet Reactor to SharedValue.) (Update 2011/12/02 9:04:01(UTC+09:00) : renamed some variables..)

    19 people like this

    Posted: 7 years ago by nagat01

  • WPF Command in F#

    demonstrate how to use object expression to create a WPF/Silverlight command.

    22 people like this

    Posted: 6 years ago by Tao Liu

  • Flappy Bird clone using WPF

    Flappy bird clone script using WPF, click the mouse or hit space to flap, no collision detection.

    5 people like this

    Posted: 3 years ago by Phillip Trelford

  • WPF/Silverlight Attached Property

    Example of a WPF/Silverlight Attached Property (AP). This is a port of a C# AP implementation that can be found at

    0 people like this

    Posted: 2 years ago by Daniel Mohl

  • WPF Event to Command

    This snippet provides an example of a WPF Event to Command behavior.

    4 people like this

    Posted: 10 months ago by Daniel Mohl

  • WPF generic value converter for Discriminated Unions

    A generic value converter for discriminated unions, it allows to use a single converter for any discriminated union along with facilitating the creation of new ones with a default option value for when an incompatible union case is provided. Large part of this snippet uses as a base, all credit on the ConverterBase goes to him, one of the authors also has a new version of it

    1 people like this

    Posted: 28 days ago by Micael Morais