Rash thoughts about .NET, C#, F# and Dynamics NAV.

"Every solution will only lead to new problems."

Thursday, 22. March 2012

WPF Designer for F#

Filed under: C#,F#,WPF — Steffen Forkmann at 19:19 Uhr

F# 3.0 brings the new type providers feature which enables a lot of different applications. Today I’m happy to announce that the FSharpx project brings you a WPF designer for F# in the Visual Studio 11 beta.


A big kudos to Johann Deneux for writing the underlying XAML type provider.

  1. Create a new F# 3.0 Console application project
  2. Set the output type to “Windows Application” in the project settings
  3. Use nuget and install-package FSharpx.TypeProviders.Xaml
  4. Add references to WindowsBase.dll, PresentationFramework.dll, System.Xaml.dll and PresentationCore.dll
  5. Add a Xaml file to your project. Something like this:
  6. Now you can access the Xaml in a typed way:
  7. Start the project


BTW: No code generation needed is for this. No more nasty *.xaml.cs files.
BTW2: Try to change the name of Button1 in the Xaml and press save. Zwinkerndes Smiley

Tags: , , , ,


  1. Amazing, man! Congrats!

    Comment by Rodrigo Vidal — Thursday, 22. March 2012 um 19:31 Uhr

  2. […] WPF Designer for F# (Steffen Forkmann) […]

    Pingback by Dew Drop – March 23, 2012 (#1,293) | Alvin Ashcraft's Morning Dew — Friday, 23. March 2012 um 13:34 Uhr

  3. Wow, this is really cool.
    Thanks for your work!

    Comment by Daniil — Tuesday, 27. March 2012 um 19:16 Uhr

  4. I chose to learn fsharp bc of type providers. We are only seeing the tip of the iceberg…

    Comment by Nicolas — Friday, 20. April 2012 um 20:03 Uhr

  5. Hi Steffen,

    One thing I ran into with this is that Visual Studio sometimes doesn’t pick up when the XAML has changed — it doesn’t always rebuild when you change the XAML and re-run the project. I don’t think this is necessarily a type provider issue, more likely a F# project system issue, but if any of your readers come across it, the workaround is to clean the project before re-running.

    Comment by Ivan — Monday, 30. April 2012 um 2:29 Uhr

  6. […] plus there are a couple of things that may not be quite so obvious! (This example is based on Steffen Forkmann’s WPF Designer for F# announcement, which is in turn based on Johann Deneux’ XAML type […]

    Pingback by Mindscape Blog » Blog Archive » Using WPF Elements from F# — Monday, 30. April 2012 um 3:07 Uhr

  7. […] FSharpx.TypeProviders.Xaml which includes a type provider for XAML files and therefor enables to use Visual Studios’s WPF Designer from F#. [Read more] […]

    Pingback by FSharpx type providers are available as separate nuget packages » Rash thoughts about .NET, C#, F# and Dynamics NAV. — Wednesday, 26. September 2012 um 20:21 Uhr

  8. Is it possible to do code behind with this. For example if you have a custom user control which you want to add behaviour to via f# is it possible to use this technique so that when you add you’re custom control to the palette the code behind additions are also added?

    Comment by Brad Phelan — Sunday, 23. December 2012 um 19:04 Uhr

  9. Merci beaucoup pour cette explication !

    Comment by dsb29 — Tuesday, 8. January 2013 um 10:45 Uhr

  10. I really like this. Thanks Steffen.

    I used it for an F#J article “Create World … and other 3D”, substituting the C# xaml plumbing with this clean technique. My intro to it was the short blurb in Expert F# 3.0.

    Have you gotten other user experience feedback?

    Comment by Art Scott — Friday, 15. February 2013 um 0:12 Uhr

  11. […] Steffan Forkmanm’s post for more information about this. Lets also not forget about first class events and the […]

    Pingback by F# end to end | FourEightThree — Saturday, 23. February 2013 um 18:46 Uhr

  12. […] development completely in F#. Steffen Forkmann has an excellent blog post about its usage “WPF Designer for F#“. It is probably one of my favorite posts about F# at all, it shows a real beauty […]

    Pingback by WPF MVVM with Xaml Type Provider | Sergey Tihon's Blog — Saturday, 27. April 2013 um 18:39 Uhr

  13. Great work, but it’s giving an error:
    “The type FrameworkElement is not compatible with the type Window” in this line at “loadWindow”:

    (new Application()).Run(loadWindow())

    XAML compiles, but Needs the added Name Attribute in the root element as noted on the download website.

    Comment by Wolfgang — Monday, 28. October 2013 um 21:16 Uhr

  14. Thanks a lot..And how can i invoke my WPF Application from F#.. (i am having a project with Window.XAML and Window.XAML.cs .. need to invoke initialisecomponent() of Window.XAML.cs..

    Paul Ra Je

    Comment by paul ra je — Monday, 24. February 2014 um 4:48 Uhr

RSS feed for comments on this post. | TrackBack URI

Leave a comment

XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .