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.

    109 people like this

    Posted: 14 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.

    67 people like this

    Posted: 13 years ago by Phillip Trelford

  • F# Quotations with INotifyPropertyChanged

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

    16 people like this

    Posted: 13 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: 13 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..)

    22 people like this

    Posted: 13 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: 12 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.

    6 people like this

    Posted: 9 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 http://www.silverlightshow.net/items/Attached-Properties-in-Silverlight.aspx.

    0 people like this

    Posted: 8 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: 6 years 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 http://fssnip.net/62 as a base, all credit on the ConverterBase goes to him, one of the authors also has a new version of it http://fssnip.net/7Q

    1 people like this

    Posted: 5 years ago by Micael Morais

  • 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.

    124 people like this

    Posted: 14 years ago by Blake Coverett

  • WPF DepdencyProperty

    Declaring WPF DependencyProperty in F#

    21 people like this

    Posted: 13 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.

    8 people like this

    Posted: 13 years ago by Cetin Sert

  • WPF / SilverLight Converter II

    version 1 is http://fssnip.net/62. 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.

    90 people like this

    Posted: 13 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.

    8 people like this

    Posted: 12 years ago by nagat01

  • Sierpinski triangle, WPF

    Draws a Sierpinski triangle using WPF

    12 people like this

    Posted: 12 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 - http://elm-lang.org/. It is just an proof of concept. See the library code and a few working examples at https://github.com/Zdenek-Pavlis/impF

    6 people like this

    Posted: 8 years ago by Zdenek Pavlis

  • WPF async access.

    Computation builder for async access.

    1 people like this

    Posted: 7 years 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 :)

    4 people like this

    Posted: 6 years ago by asdf

  • WPF Custom Control

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

    4 people like this

    Posted: 1 year ago by Fahad