How to: Design Silverlight User Interfaces
Applies to: Functional Programming
Published: January 2010
Summary: This group of articles looks at how to accomplish common tasks when creating and designing Silverlight user interfaces in F#.
This topic contains the following sections.
This article is associated with Real World Functional Programming: With Examples in F# and C# by Tomas Petricek with Jon Skeet from Manning Publications (ISBN 9781933988924, copyright Manning Publications 2009, all rights reserved). No part of these chapters may be reproduced, stored in a retrieval system, or transmitted in any form or by any means—electronic, electrostatic, mechanical, photocopying, recording, or otherwise—without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews.
When creating user interfaces for Silverlight applications in F#, it is possible to use many of the standard techniques, including XAML designers. The look of the application can be also designed using Microsoft® Expression Blend. However, the Microsoft® Visual Studio 2010 integration for F# differs from the support for C# and Visual Basic. In particular, a XAML file needs to be added in a different way and loaded explicitly. Also, the user interface elements need to be accessed using a different technique.
This section includes several how-to articles that contain easy to follow guidelines presenting the best way of accomplishing these common tasks in F#. The first explains how to add XAML file to an F# project, and the second demonstrates the best approach for accessing user interface elements from code.
This article shows how to use XAML in an F# Silverlight project and how to design a user interface using Microsoft Blend.
This article shows how to implement the F# dynamic operator (?), which enables easy access to user interface elements created in XAML.
The articles above discuss only specific aspects of user interface development. For more complete guides that create complete applications or components, see one of the following tutorials:
This article is based on Real World Functional Programming: With Examples in F# and C#. Book chapters related to the content of this article are:
Chapter 9: “Turning values into F# object types with members” explains how to use object-oriented features of the F# language. This is an important topic for client-side development because it explains how to mix the object-oriented Silverlight design with the functional programming style.
Chapter 16: “Developing reactive functional programs” discusses how to write reactive user interfaces using asynchronous workflows and events. It also includes a basic introduction to the Reactive Framework (Rx).
To download the code snippets shown in this article, go to http://code.msdn.microsoft.com/Chapter-3-Reactive-Client-8a458f7d
Previous article: Tutorial: Implementing a Chat Client Using Asynchronous Workflows