This template is for a basic F# Windows Presentation Foundation (WPF) project. This template can be found on the Visual Studio Gallery:
When the template is installed you get the following template added to your F# folder when creating a new F# project:
This template that defines the following project elements:
- MainWindow.fs: This is a module that has a single initControls() function that take in a Window element. The module provides a TODO tag showing the location for processing window elements and hooking up window events.
- MainWindow.xaml: The XAML for the main window of the application.
- App.xaml: XAML used for starting up the MainWindow window.
- Program.fs: This controls the displaying of the window and ensures the STA Thread is used.
The MainWindow.fs file provides the structure for processing the window elements.
The MainWindow.fs code listing is:
It demonstrates processing of window elements and how to add events for these elements.
The Program.fs code is:
The purpose of this code is rendering the main application window and calling the initControls() code.