Snippets tagged Silverlight
F# 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 TrelfordCalculator
Simple Silverlight Calculator UI interactive sample runnable inside http://tryfsharp.org.
0 people like this
Posted: 12 months ago by Phillip TrelfordCalculator
Simple Silverlight Calculator UI interactive sample runnable inside http://tryfsharp.org.
0 people like this
Posted: 12 months ago by Phillip TrelfordFormula Calculator
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 this
Posted: 12 months ago by Phillip TrelfordSimple F# ViewModel for Silverlight MVVM
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.
4 people like this
Posted: 11 months ago by Tuomas HietanenSilverlight asynchronous WebService call with UI-thread syncronization dispatcher
You can use this code to make a async WebRequest from Silverlight to update ViewModel.
4 people like this
Posted: 11 months ago by Tuomas HietanenTetris
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
10 people like this
Posted: 10 months ago by Phillip TrelfordStill Mouse Click Event Using Scan
Detects a mouse down then up event without a move.
1 people like this
Posted: 10 months ago by Zach Bray
Still Mouse Click Event
Detects a mouse down then up event without a move.
3 people like this
Posted: 10 months ago by Phillip TrelfordWPF/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 MohlWPF/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 MohlSpreadsheet
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
2 people like this
Posted: 1 years ago by Phillip TrelfordGrowing Tree Algorithm for Maze Generation
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.
8 people like this
Posted: 8 months ago by Natallie BaikevichWPF / 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 LiuPong
Pong video game runnable inside TryFSharp.org. Player 1 keys 'Q' - up, 'A' - down. Player 2 keys 'P' - up, 'L' - down.
5 people like this
Posted: 3 months ago by Phillip TrelfordWrapPanel
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 this
Posted: 2 months ago by Phillip TrelfordWPF 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 Liu