Sunday, November 30, 2014

Evolution of the F# Empty WPF Template

Back in March 2012, I announced that the F# Empty WPF project template had been enhanced to include a type provider from the FSharpx type providers collection. Today, another evolution of the F# Empty WPF template has occurred. The FSharpx.TypeProviders.Xaml type provider has been replaced with Reed Copsey's FsXaml for WPF type provider.

Building a Simple Example:

It's very easy to get started with the latest version of the template as well as FsXaml. Here the steps to create an overly simple example with the new version of the template, FxXaml and FSharp.ViewModule.Core (which is also inclueded in the template):

1. Create a new project with the latest version of the F# Empty Windows App (WPF) template.
2. Build the project and Enable the type provider when requested to do so. You can now run the project, which at this point simply displays a blank screen.
3. Open the MainWindow.xaml.fs file and replace the contents with the following:


4. Open the MainWindow.xaml file add the following to the Grid element:


After this change, the MainWindow.xaml file will look something like the following with one small different depending on what you named your project:


For additional examples checkout the demos in the FsXaml GitHub repo.

5 comments:

  1. Thanks! However, the message "Input string was not in a correct format" seems to have reappeared. Changing the region settings to "English (US)" helped.

    ReplyDelete
  2. I was really impressed by reading this blog. We are also giving all software Course Online Training. The Hadoop Training in Chennai is one of the reputed Training institute in Chennai. They give professional and real time training for all students.

    ReplyDelete
  3. This is really nice... very nice job and thanks for this.

    ReplyDelete
  4. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing. Android training in chennai | Android training chennai |Android course in chennai | Android course chennai

    ReplyDelete