Getting Started with WPF

Publish Date: Mar 07, 2013 | 3 Ratings | 3.33 out of 5 |  PDF

Overview

The Windows Presentation Foundation architecture and programming model strays from the familiar Windows Forms approach enough that the average .NET developer must prepare to learn a few lessons. We believe this investment is well worth the learning curve considering WPF is Microsoft's premier technology for creating Windows graphical interfaces. As the modern software experience continues to evolve, we expect this will more than necessary, it will be inevitable.

Table of Contents

  1. Topics to Learn
  2. Where to Get Resources
  3. Microsoft Visual Studio for WPF Development
  4. Deciding between WPF and Windows Forms Controls
  5. Additional Resources

1. Topics to Learn

Before getting started with WPF, an understanding of the .NET framework and .NET programming experience is a major pre-requisite. Learning WPF requires learning XAML (eXtensible Application Markup Language), a new language and new file type that provides a declarative model for application programming. You will need to get a handle on WPF specific concepts of dependency properties, binding, styling and templating, and the layout system. Before you begin developing WPF applications, you should be familiar with the following concepts:

  • The WPF Programming Model - Creating applications with WPF and Windows Forms is different in several significant ways, and familiarizing yourself with these differences helps you acclimate more quickly to WPF. Among the many features that are different are the WPF base element classes, the WPF class hierarchy, and the use of XAML for declarative application programming.
  • Data Binding - Data binding is used much more prominently and works differently in WPF than in Windows Forms. To utilize WPF functionality fully, review Microsoft’s documentation on Data Binding for WPF before you begin developing applications with Measurement Studio WPF controls.
  • Vector vs. Raster Graphics for Graph Controls - Measurement Studio graph controls provide two different modes of rendering: vector and raster. Vector rendering provides richer functionality and raster rending provides better performance. Being familiar with these types of rendering can help you make decisions that affect your application speed.

Advanced Topics

Next you can focus on understanding how to use particular features like graphics, multimedia and Model View ViewModel (MVVM).

Back to Top

2. Where to Get Resources

Given that Windows Presentation Foundation is a Microsoft technology, we defer to the owners and experts for the best possible training materials to help you develop WPF and XAML expertise. Below are some recommended materials available through the online Microsoft community. This is not a comprehensive list of tutorials, so we advise you to explore additional resources as well.

MSDN Documentation

Microsoft Developer Network is a collection of sites for the developer community that provide information, documentation, and discussion which is authored both by Microsoft and by the community at large.

WindowsClient.NET

WindowsClient.NET is a Microsoft portal site for the Windows Forms and Windows Presentation Foundation (WPF) developer community. Here you will find code and controls to download, How-To videos and tutorials as well as discussion forums where you can post questions.

Back to Top

3. Microsoft Visual Studio for WPF Development

Microsoft Visual Studio is an integrated development environment for creating WPF, Windows Forms and Web Forms applications. Visual Studio is great for writing and editing .NET code and XAML, it includes a graphical designer for WPF starting with version 2008. If you're using Visual Studio 2005 you can install an add-on that enables you to develop WPF applications.

Other Useful Tools from the WPF Community

These tools can be very useful and are often free and open source. We invite you to research these.

  • Snoop - excellent for debugging XAML
  • WPF Performance Suite - suite of performance profiling tools
  • IL Spy - .NET assembly browser and decompiler

Back to Top

4. Deciding between WPF and Windows Forms Controls

Measurement Studio WPF controls offer richer display options than Windows Forms controls, and also offer a greater ability to browse data at higher resolutions by panning and zooming on the graph without losing precision. Measurement Studio Windows Forms controls offer rich design-time support and a mature control set.

Take the following steps to decide when to create a WPF application and when to create a Windows Forms application:

  1. Determine what controls your application needs.
  2. Determine what features within those controls you application needs.
  3. Determine if the WPF control or the Windows Forms control includes the functionality your application needs.

Create a WPF application if you want to take advantage of the following:

    • Rich, resolution-independent user interfaces using vector-based drawing
    • Advanced data binding
    • Native data precision in graph and numeric controls
    • Declarative code, rather than procedural
    • Separation between user interface design and code, using the Model View ViewModel (MVVM) design pattern
    • Controls that are not offered in Measurement Studio Windows Forms control set

Create a Windows Forms application if you want to take advantage of the following:

    • Established control set
    • Extensive sample code and documentation
    • Improved integration with National Instruments .NET Hardware APIs
    • Controls that are not offered in the Measurement Studio WPF control set

Back to Top

5. Additional Resources

Previous Tutorial: WPF in Test and Measurement

Next Tutorial: Customizing Measurement Studio WPF Controls for a Unique User Interface

Back to Windows Presentation Foundation Home Page

Learn about NI Measurement Studio Tools for .NET Developers

Back to Top

Bookmark & Share

Ratings

Rate this document

Answered Your Question?
Yes No

Submit