Share via


Designing User Interfaces

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Your development of user interfaces, for your hardware that supports a display device, benefits from the .NET Micro Framework's customized version of Windows Presentation Foundation (WPF). This WPF version offers highly targeted functionality that contains only what you need to create streamlined applications for the smallest devices.

The .NET Micro Framework and Windows Presentation Foundation

To enable you to create user interfaces in an efficient and straightforward way, the .NET Micro Framework provides its own version of Windows Presentation Foundation (WPF). As with all aspects of the .NET Micro Framework, this version of WPF is optimized for small hardware devices. Therefore, it does not support all of the functionality provided by Windows Vista WPF. Instead, it offers highly targeted functionality that contains only what you need to create attractive, streamlined applications for very small devices.

The .NET Micro Framework provides its WPF API elements in the namespaces listed and described in the following table.

Namespace

Description

Microsoft.SPOT.Input

Contains tools for collecting and managing user input.

Microsoft.SPOT.Presentation

Provides the ability to design and control the layout and display of graphical user interface elements.

Microsoft.SPOT.Presentation.Controls

Enables your program to create elements (known as controls) that make it possible for users to interact with the programs. This namespace also provides support for displaying text.

Microsoft.SPOT.Presentation.Media

Gives your applications the tools required to draw and manipulate bitmapped images.

Microsoft.SPOT.Presentation.Shapes

Provides tools that enable your programs to draw two-dimensional (2-D) geometric shapes.

User Interface Essentials

WPF helps you build applications that consist of an Application object and a set of pages. The Application object enables you to handle top-level events, and to share code and state among pages.

After creating an Application object, your program can associate one or more Window objects with the Application object. Window objects represent and display both windows and dialog boxes. Within a window or dialog box, your program can display controls, print text, show bitmaps, or draw 2-D shapes.

Note

The .NET Micro Framework does not support icons in resource files.

JJ610649.collapse_all(en-us,VS.113).gifTimers and User Interfaces

When creating your user interfaces with the .NET Micro Framework version of WPF, it is strongly recommended that you use the DispatchTimer class rather than the Timer class. This is because the WPF classes for the .NET Micro Framework are not thread-safe. You can avoid this potential problem by using objects from the DispatchTimer class.

JJ610649.collapse_all(en-us,VS.113).gifFonts

In the .NET Micro Framework, all fonts use the .tinyfnt file format. The TFConvert tool can create a .tinyfnt file from a TrueType or OpenType font file. To use a font, add its .tinyfnt file to your project's resources. Once a font resource has been added to your project, you may reference it from your application. For example, the following code creates a text control and sets its font to the font contained in the small.tinyfnt file.

// Create a single text control.
        Text text = new Text();
        // Set Font
        text.Font = Resources.GetFont(Resources.FontResources.small);

JJ610649.collapse_all(en-us,VS.113).gifBitmaps

The .NET Micro Framework's implementation of the Windows Presentation Foundation supports both GIF and JPEG images with the following restrictions.

  • Interlaced GIF images are not supported. If the bitmap is an animated GIF that contains multiple images, the framework displays only the first image.

  • Jpeg images can contain a maximum of 3 channels.

Note

Files sizes are limited by the number of heap blocks in a heap cluster. This size limitation is different for each hardware platform. Please see your hardware's documentation for details.