Oct
19
2009
Lot of news this week!
Visual Studio 2010 and .NET Framework 4 Beta 2 are now available for download here, Jeff Beehler has posted some useful info about this “go live” release.
The new Silverlight Toolkit October 2009 Release is also available on Codeplex featuring Visual Studio 2010 support and various improvements on existing components (like drag-and-drop for items controls).
Read these posts by Tim Heuer and Jeff Wilcox for more details and enjoy!
2 comments | tags: .NET, .NET Programming, C#, F#, Programming, Silverlight 3, Visual Studio, WPF, XAML | posted in .NET Programming, News, Programming, Rich Internet Applications
Oct
15
2009
Many MVVM implementations are available on the net, personally I love the approach used by Laurent Bugnion in the MVVM Light toolkit and Michael Sync in the Silverlight MVVM toolkit (Jeremiah Morril have posted a great article about this pattern, don’t forget to read it here).
All these examples use C#, what about F# for describing ViewModel classes? F# is a very powerful and readable language and permits to perform operations using a small amount of code. Last, but not least, at this time it’s a first citizen .NET language and can be easily used in Silverlight applications as well.
How can we build a Silverlight MVVM solution using F#?
First of all, download and install the F# for Silverlight templates and samples.
Let’s start by defining a simple F# ViewModel class containing a simple “Name” property and a “SearchCommand”, this one using the DelegateCommand implementation available in Prism:
namespace SilverlightViewModelFSharp.ViewModels
open System.ComponentModel
open Microsoft.Practices.Composite.Presentation.Commands;
open System.Windows
type MainPageVM() =
//Definition of the PropertyChanged event
let event = Event<PropertyChangedEventHandler, PropertyChangedEventArgs>()
//Definition of the "name" property
let mutable name = "This is the value of a property defined in the F# ViewModel"
//Definition of a test Command
let searchCommand = new DelegateCommand<string>(fun (x) -> MessageBox.Show(x) |> ignore )
//INotifyPropertyChanged interface
interface INotifyPropertyChanged with
member this.add_PropertyChanged(e) = event.Publish.AddHandler(e)
member this.remove_PropertyChanged(e) = event.Publish.RemoveHandler(e)
//Definition of the "Name" property
member this.Name
with get() = name
and set(v) =
name <- v
event.Trigger(this, new PropertyChangedEventArgs("Name"))
//Definition of the "SearchCommand"
member this.SearchCommand
with get() = searchCommand
Cool, don’t you love this F# syntax? It’s so readable
Now we are ready to bind the MainPageVM to a xaml view inserting this simple code:
<StackPanel Orientation="Vertical">
<!-- Example of binding to a F# ViewModel Command -->
<Button Height="40" Content="Click me!"
cmd:Click.Command="{Binding SearchCommand}"
cmd:Click.CommandParameter="Hello from a ViewModel F# Command parameter"/>
<!-- Example of binding to a F# ViewModel property -->
<TextBlock Text="{Binding Name}" Height="40"/>
</StackPanel>
To make the ViewModel magic work, just assign the MainPageView DataContext with the F# ViewModel:
public MainPageView()
{
InitializeComponent();
this.DataContext = new MainPageVM();
}
The source code is available for download here.
New: updated the source code for Visual Studio 2010 Beta 2.
Happy Silverlighting!!
4 comments | tags: .NET Programming, F#, Patterns, Programming, Silverlight, Silverlight 3 | posted in .NET Programming, Programming, Rich Internet Applications
Mar
2
2009
Brian McNamara has posted two nice articles:
no comments | tags: .NET Programming, F# | posted in .NET Programming, Programming
Dec
31
2008
Bill Reiss has written an excellent post about embedding F# class libraries in a C# Silverlight application. A must read!
no comments | tags: F#, Programming, Silverlight | posted in .NET Programming, Programming, Rich Internet Applications
Nov
9
2008
In this post, Luke introduces the F# support for Azure services using the F# Templates and Samples for Windows Azure:

F# Visual Studio Templates
no comments | tags: .NET Programming, Cloud Computing, F#, Visual Studio, Windows Azure | posted in .NET Programming, Cloud Computing
Nov
1
2008
A great session by Luca Bolognese at PDC2008 is available here.
Update: the code is available in this post.
no comments | tags: .NET Programming, F#, Programming | posted in .NET Programming
Sep
4
2008
Click here to read the post by Don Syme.
no comments | tags: .NET Programming, F# | posted in .NET Programming
Jul
10
2008
From http://www.codeplex.com/vslab:
“Visual Studio Lab (VSLab) exploits the power of F# and its interactive top level to provide an interactive environment similar to MatLab and Mathematica, in which you can easily create Add-ins and interact dynamically with them inside Visual Studio. Moreover, since F# is a compiled language, the final code can be compiled as a standalone application.
Goal of the project is to provide the basic infrastructure to turn Visual Studio in VSLab, and a number of addins (called viewlets) used to show data and support development of scientific based applications.”
Useful links:
no comments | tags: .NET Programming, Education, F#, Visual Studio | posted in .NET Programming, Education
Oct
22
2007
Take a look here for a list of resources about the F# language, a research project from Microsoft.
F# is a new “scripted, functional, imperative, object-oriented programming language“.
It seems to be very interesting!
no comments | tags: .NET, F# | posted in .NET Programming