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 thisPosted: 13 years ago by Phillip Trelford
ViewModelBase for F# users who want to use it in WPF / Silverlight
16 people like thisPosted: 13 years ago by Fahad
Simple Silverlight Calculator UI interactive sample runnable inside http://tryfsharp.org.
1 people like thisPosted: 13 years ago by Phillip Trelford
Silverlight default architecture is Model-View-ViewModel. This code gives full design time support for Microsoft Expression Blend. The F# ViewModel is seen as strongly typed data source in the Blend UI. There are two properties binded to the view: HiLabel (OneWay data binding) and MyName (TwoWay data binding). ViewModel implements the INotifyPropertyChanged to support the binding. The view project (HelloApp) is made with Blend (by designers) and it is Silverlight 5.0 project. The view codebehind is c# file and it has only this.DataContext -assignment. The viewmodel project (HelloApp.ViewModel) is F# Silverlight 4.0 library. It is made with VS2010 and F# (by developers). It contains the logical functionality of the current view.
5 people like thisPosted: 13 years ago by Tuomas Hietanen
Playable Tetris mini-game. Use arrow keys to move left and right and up to rotate, down to drop. Try it out in the browser on TryFSharp.org
18 people like thisPosted: 13 years ago by Phillip Trelford
Detects a mouse down then up event without a move.
4 people like thisPosted: 13 years ago by Zach Bray
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 thisPosted: 13 years ago by Tao Liu
Positions child elements in sequential position from left to right, breaking content to the next line at the edge of the containing box. Tryable at http://tryfsharp.org
3 people like thisPosted: 12 years ago by Phillip Trelford
Zombie state machine code sample. Use arrow keys to move humanoid. Robots activate when in range of humanoids. Try it out in the browser with TryFSharp.org.
6 people like thisPosted: 12 years ago by Phillip Trelford
Single level retro game playable inside TryFsharp using the cursor keys.
9 people like thisPosted: 12 years ago by Phillip Trelford
There are several maze creation algorithms (http://www.astrolog.org/labyrnth/algrithm.htm). The interesting point about Growing Tree one is that it turns into the others (for example, Recursive Backtracker and Prim's algo) when we choose the next step in different ways. Check it with tryfsharp.org.
4 people like thisPosted: 7 years ago by Natallie Baikevich
Spreadsheet script runnable inside http://tryfsharp.org includes a custom DataGrid and a parser for simple formulas e.g.: =1+1 =SUM(A1,A2) Add your own functions to the evaluate function. For a more comprehensive implementation check out http://cellz.codeplex.com
6 people like thisPosted: 13 years ago by Phillip Trelford
Simple Silverlight Calculator UI interactive sample runnable inside http://tryfsharp.org.
0 people like thisPosted: 13 years ago by Phillip Trelford
Simple formula calculator including dynamic unit of measure support. Run as a script in Try F#, and try formula with units like 3m * 3m.
0 people like thisPosted: 13 years ago by Phillip Trelford
You can use this code to make a async WebRequest from Silverlight to update ViewModel.
5 people like thisPosted: 13 years ago by Tuomas Hietanen
Detects a mouse down then up event without a move.
4 people like thisPosted: 13 years ago by Phillip Trelford
Example of a WPF/Silverlight Value Converter base class and concrete implementation.
6 people like thisPosted: 13 years ago by Tao Liu and Daniel Mohl
Pong video game runnable inside TryFSharp.org. Player 1 keys 'Q' - up, 'A' - down. Player 2 keys 'P' - up, 'L' - down.
7 people like thisPosted: 12 years ago by Phillip Trelford
demonstrate how to use object expression to create a WPF/Silverlight command.
22 people like thisPosted: 12 years ago by Tao Liu
Solution to Minesweeper Kata second challenge at Goto Copenhagen 2012 conference "Programming with the Stars" track. Runnable at http://tryfsharp.org.
2 people like thisPosted: 12 years ago by Phillip Trelford
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 thisPosted: 8 years ago by Daniel Mohl
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 thisPosted: 6 years ago by Micael Morais