Create Amazing Custom User Interfaces with WPF, C#, and XAML in .NET 3.0 - Andrew Moore - E-Book

Create Amazing Custom User Interfaces with WPF, C#, and XAML in .NET 3.0 E-Book

Andrew Moore

0,0
6,40 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

This Wrox Blox presents WPF along with the Extensible Application Markup Language (XAML), showing developers how to customize existing user interface controls such as the Button, Progress Bar, CheckBox, Radio Button, and Label along with creating two new custom controls. The Windows Presentation Foundation (WPF) released with the .NET 3.0 SDK provides a rich foundation for developing and customizing user interfaces. Unlike existing user interface development tools like GDI and GDI+, WPF is entirely vector-based, offering the developer enhanced two-dimensional and even three-dimensional rendering in the presentation layer. The author customizes these existing controls using XAML to:* Create control templates to define their appearance and behaviors.* Create two new custom controls, one derived from System.Windows.UserControl and the second from System.Windows.Control.* Illustrate the interoperability of WPF content in Windows Forms and Win32 applications.* Create the code samples using Microsoft Visual Studio 2005 with extensions for .NET 3.0 and the .NET 3.0 SDK. These code samples contain four projects: A C# WPF control library that contains the control templates and a User Control containing the customized Windows controls and the two new custom controls; a C# WPF application to host the WPF User Control; a C# Windows Forms application to host the WPF User Control; and a C++ Win32 application to host the WPF User Control.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 36

Veröffentlichungsjahr: 2010

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Contents

Create Amazing Custom User Interfaces with WPF, C#, and XAML in .NET 3.0

Overview

Summary

About Andrew Moore

Create Amazing Custom User Interfaces with WPF, C#, and XAML in .NET 3.0

The Windows Presentation Foundation (WPF) released with the .NET 3.0 SDK provides developers with a rich toolkit for creating compelling user interfaces for .NET applications. Windows applications traditionally present the user with a main window with menus, dialog boxes, and toolbars containing user interface controls such as buttons, checkboxes, labels, progress bars, and the like. Typically developers create applications by selecting the appropriate controls to represent whatever data are required for the applications along with any necessary actions and user inputs, and placing those controls on a dialog using the Resource Editor for Win32 applications or the Windows Forms designer for .NET Windows Forms applications. This gives Windows applications a standard appearance that is mostly uniform across most applications developed for the Windows platform. WPF and the Extensible Application Markup Language (XAML) add a new dimension to this model, providing developers with a declarative approach to user interface development. No longer restricted to dragging controls on a dialog editor, developers can now declare the entire user interface layout in an XML format along with declaring styles much as web developers do with cascading style sheets. Styles can now be applied and modified for the entire application without having to reconfigure the layout of each dialog and window in the application or modifying any code.

The graphical toolkits used in the past for drawing on the surface of Windows controls, Graphical Device Interface (GDI) for Win32 applications and more recently the Graphical Device Interface Plus (GDI+) for Win32, and .NET Windows Forms applications are raster-based toolkits that allow the developer to draw geometry such as lines, curves, rectangles, and circles along with performing graphics transformations such as translation, scaling, and rotation. While these provide the developer with a powerful platform for drawing graphics on Windows surfaces, the user interface frameworks themselves do not facilitate the customization of existing Windows user interface controls without the developer writing a lot of code.

The introduction of WPF for .NET 3.0 provides developers with a toolkit to easily customize the appearance of existing Windows controls or create new ones. WPF makes it easy to have buttons flip when pressed, have a glass-like appearance, or have checkboxes with a custom fill when checked. The possibilities are only limited by your creativity.

Overview

This Wrox Blox uses WPF to create a custom control library to customize the appearance of some common Windows controls like the button, progress bar, checkbox, radio button, and label. You will also use WPF to create two new custom controls. The controls from this custom control library will be included in a WPF application, a Windows Forms application, and finally in a native Win32 application. Specifically, this Wrox Blox covers the following:

Creating a WPF application using Visual Studio 2005.Creating a WPF custom control library using Visual Studio 2005.Creating control templates to customize common control appearance using XAML.Custom control authoring using the UserControl base class.Custom control authoring using the Control base class.Interoperability of WPF in Windows Forms and Win32 applications.

To get started with developing custom controls for WPF, you need the .NET 3.0 SDK available from Microsoft at http://www.microsoft.com/downloads/details.aspx?FamilyID=C2B1E300-F358-4523-B479-F53D234CDCCF&displaylang=en. The .NET 3.0 SDK is not a stand-alone download but is part of the entire Windows Platform SDK available for Windows Vista and Windows XP Service Pack 2. Once you have the .NET 3.0 SDK installed, you need the Microsoft Visual Studio 2005 extensions for .NET 3.0 and the .NET 3.0 SDK available here: http://www.microsoft.com/downloads/details.aspx?FamilyID=F54F5537-CC86-4BF5-AE44-F5A1E805680D&displaylang=en.

Get started with developing a custom control library with WPF as follows:

1. Launch Microsoft Visual Studio 2005.

2. Create a new solution called WPF Controls.

3. Add a new Windows application (WPF) project called WPF Controls to the solution.

See Figure 1 for an example of creating a new WPF application in Visual Studio.

Figure 1. New WPF application in Visual Studio

This is the application that will host your WPF custom controls. You will create a second project as a custom control library (WPF) called CustomControlLibrary. This project will contain all of your custom controls and create the assembly that can be included in your WPF, Windows Forms, and Win32 applications. Now that you have your projects created, you can get to work creating your control library.

Control Templates