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.
59 people like this
Posted: 1 years ago by Antonio CisterninoFSX 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.
66 people like this
Posted: 1 years ago by Blake CoverettWPF Custom Control
This snippet shows how to create a WPF custom control library in F#.
30 people like this
Posted: 1 years ago by FahadWPF DepdencyProperty
Declaring WPF DependencyProperty in F#
16 people like this
Posted: 1 years ago by FahadF# Quotations with INotifyPropertyChanged
ViewModelBase for F# users who want to use it in WPF / Silverlight
6 people like this
Posted: 1 years ago by FahadObservableObject
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.
45 people like this
Posted: 1 years ago by Phillip TrelfordA 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.
5 people like this
Posted: 11 months ago by Cetin SertWPF/Silverlight Value Converter
Example of a WPF/Silverlight Value Converter base class and concrete implementation.
5 people like this
Posted: 10 months ago by Tao Liu and Daniel Mohl
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.
2 people like this
Posted: 10 months ago by Daniel MohlWPF Event to Command
This snippet provides an example of a WPF Event to Command behavior.
3 people like this
Posted: 10 months ago by Daniel MohlWPF / 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.
74 people like this
Posted: 8 months ago by Tao LiuBuilding 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..)
6 people like this
Posted: 5 months ago by nagat01Drag 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.
3 people like this
Posted: 4 months ago by nagat01WPF Command in F#
demonstrate how to use object expression to create a WPF/Silverlight command.
17 people like this
Posted: 2 months ago by Tao LiuSierpinski triangle, WPF
Draws a Sierpinski triangle using WPF
8 people like this
Posted: 2 months ago by Mathias Brandewinder