Showing posts with label XAML. Show all posts
Showing posts with label XAML. Show all posts

Monday, March 26, 2012

A Nice Addition to the Empty WPF F# Template

A few days ago Steffen Formann announced a Xaml type provider that he and Johann Deneux have created that makes writing WPF apps in F# very easy. This type provider allows strongly typed access to the XAML, effectively providing the missing piece to allowing full F# WPF designer support. I've now updated the Empty WPF F# Template to include this type provider.

To use it, all you have to due is download/install the latest version of the F# Empty Windows App (WPF) template in VS11. This will generate an F# project with all the needed WPF assembly references. It also automatically installs the FSharpx.TypeProviders NuGet package and provides the starting point for creating WPF apps with the new Xaml type provider.

Here's a screenshot that's pretty similar to what Steffen showed in the announcement post. Note: The button and label were manually added after creating the project from the updated template.


One other piece that can be helpful when creating WPF apps in F# is the XAML related item templates (i.e. Page, User Control, Window, etc). Item templates are provided via the F# XAML Item Templates extension found at http://visualstudiogallery.msdn.microsoft.com/06c6ece1-2084-4083-a0f7-934fce9d22fb.

Monday, January 23, 2012

Making F# Windows Phone Development a Little Easier

About a month ago, I announced that most of the existing F# project templates on Visual Studio Gallery had been updated to include support for Visual Studio 11. In that post, I mentioned some new item templates that had been included in the update to the F# XAML Item Templates extension. This post provides a bit more information related to that update.

The F# XAML Item Templates extension was designed to make working with F# + WPF and Silverlight a little eaiser. I provided a brief overview of these features back in June. However, Windows Phone XAML related development was still lacking. The previous approach to adding XAML files was to either create a blank file, change the extension, and manually add the appropriate starting XAML or create the XAML from one of the C# item templates, remove the code-behind files, and tweak the resulting XAML. While neither of these options is extremely time consuming, it can quickly become annoying.

The latest update to this Visual Studio extension reduces this annoyance by providing F# Windows Phone 7 XAML item templates. Once this VSIX is installed, you can add a Windows Phone 7 XAML file by doing the following:

1. In a Windows Phone F# project, proceed with adding a new item as you normally would (i.e. Ctrl+Shift+A).

2. The resulting wizard (shown below) includes several new item templates starting with "F#..." that match the C# versions, but that do not generate C# code-behind files. 



While you still have to write the small amount of F# code to wire this up, it makes life a little bit easier.





Thursday, June 30, 2011

F# XAML Item Templates Now on Visual Studio Gallery

A new VS2010 extension is now available on Visual Studio Gallery that provides several XAML related item templates for F# projects. The provided item templates include Window for WPF as well as Page, UserControl, and ResourceDictionary for Silverlight and WPF.

To get started, do the following:

1. Download and install the extension from http://visualstudiogallery.msdn.microsoft.com/06c6ece1-2084-4083-a0f7-934fce9d22fb or through the Extention Manager in Visual Studio 2010 as shown below (Extension Manager can be found under Tools -> Extension Manager..):


2. Once installed, you will see the following option available in the Add New Item wizard for F# Silverlight projects:


3. For F# WPF projects, the Add New Item wizard will look like the following:


These item templates complement the existing F# WPF and Silverlight project templates quite well. Here is a list of a few of these project templates that are currently available on Visual Studio Gallery:

Silverlight:

F# Web Application (Silverlight)

WPF:

F# App Template with Theme
F# Windows App (WPF, MVVM)
F# WPF Application

As usual you can find the source on my github (https://github.com/dmohl/FsXAMLItemTemplate).