This course will teach you how to build business applications with Windows Presentation Foundation on top of .NET. You will learn to create functional and attractive user interfaces using XAML. Since most business applications are data-driven, you will learn how to handle data using Entity Framework Core and how to consume data from web services. Furthermore, you’ll get acquainted with the MVVM pattern, making your code easier to maintain and test.
Building Windows Applications with WPF
Voor wie is deze cursus?
Developers
Vereisten
Participants of this course need to have a good understanding of the .NET platform and have a good knowledge of C#.
Introduction to Desktop Programming with WPF
In this module students are introduced to Windows Presentation Foundation (WPF),
and how this framework can be used to build state of the art
applications.
- Introduction to the WPF Application
- WPF Architecture
- Designer/Developer Productivity: Declarative XAML
- The Visual Studio Designer
- LAB: Creating your first WPF Appplication
Introducing XAML
XAML is the UI-language for developers using the Microsoft developer stack.
This module teaches students how to use the XAML language for building desktop applications with WPF.
- What is XAML?
- XAML versus Code
- Looking at XAML Basic Syntax
- Understanding XAML Attached Properties
- Nesting Controls
- The Content property
- LAB: Working with XAML
Inside XAML
XAML can be extended for your own custom purposes. In this case you need to understand following topics.
- Extending XAML through Markup Extensions
- Understanding CLR and XML Namespace Mapping
- Naming Elements
Developers and Designers Collaboration
In a perfect world, any developer is a great designer. Unfortunately this is not the case.
XAML allows for a clean separation between designing and developing.
- Developers versus Designers
- Visual Studio as a Development Tool
- Blend as a Designing Tool
- Overview of Blend
WPF Controls
This module gives you an overview of what kinds of controls are available and how
to compose them together.
- Examining the Class Hierarchy
- Tweaking the UI with Transforms
- The power of Composability
- Content Controls, Container Controls, Header Controls, Item Controls
- Range Controls, using Text Controls
- Understanding Dependency Properties
- Routed Events
Introduction to WPF Layout
Display hardware becomes more and more diverse: big screens, small screens, high and low resolutions, adaptable font
size.
This does require some special up-front design. In this module students will learn how to build applications
that run with all kinds of resolutions and fonts.
- Look at WPF Layout Capabilities
- Absolute Layout using Canvas
- Using StackPanel, WrapPanel and DockPanel
- The do-it-all Panel: Grid
- Tweaking using Panel Attached Properties
- LAB: Building a Layout with XAML and Visual Studio
Reusability with WPF Resources
Developers have always used custom built controls to reuse some of their work.
WPF has reuse built in, so in this module students will learn how to reuse objects
for their applications.
- Reusing Objects through Resources
- Resource Inheritance
- Static Resources
- Dynamic Resources
- Resources and code-behind
- Resource Dictionaries
- LAB: Creating some Resources with Visual Studio
Animations
End users should easily see when an element on your UI is interactive, or when a
new element has been added to your window. These things can easily be accomplished by
WPF Animations, which greatly improves the user experience. In this module students will
learn how provide feedback to the user using animations.
- What are Animations?
- Working with Storyboards
- Animations in Code
- Creating Animations in Blend
Principles of WPF Styles, Triggers and Templates
Professionally built web sites use cascading style sheets (css) to quickly change
the look and feel of the site. WPF takes this to the next level with styles and
templates. In this module students will learn how to quickly customize their whole
application with styles and templates.
- Why we need Styles
- Example: Restyling a ListBox
- Intro to Templates
- Triggers
- LAB: Create a Button Template with Blend
Entity Framework Core
With .NET also comes a Entity Framework Core.
A modern, fast Object-Relational Mapper, which can run cross-platform, on Windows, Mac and Linux.
- Scaffolding your Project from an Existing Database
- Understanding the Generated Code
- Interacting with the Database with LINQ
- LAB: Scaffolding your Model from an Existing Database
Using WPF Data Binding
Once the data is retrieved, we need to display it to the user and allow changes
to be validation and captured efficiently. In this module students will learn how
to use data binding to accomplish this.
- The Need for Data Binding
- Binding in Code and Markup
- Introduction to Simple Data Binding
- Converting Data for Data Binding
- Introduction to Complex Data Binding
- Understanding Source and DataContext
- LAB: Databinding to Data with a Parent-Child Relationship
Data Validation
User input needs to be validated. Are all required properties provided? Do the values match the format?
WPF offers several options for validation that are explored in the following chapter.
- Validation Rules
- IDataErrorInfo
- INotifyDataErrorInfo
- Custom Feedback
The Visual State Manager and Custom Controls
When customizing an interactive element for your UI, you need to specify the look and feel
in all circumstances. The Visual State Manager is a mediator that allows changing styles and templates
based on certain conditions. In this module students will
learn how set up and use the Visual State Manager.
- What is the Visual State Manager?
- Parts, States, Transitions and State Groups
- Responding to State Changes
- Custom Controls with the Visual State Manager
- Using the Visual State Manager for Responsive Layout
- Using the Visual State Manager in Blend
- LAB: Customizing a Control with Visual State Manager
Introduction to the MVVM Pattern
MVVM is a version of the MVC pattern designed specifically for WPF, which heavily relies on Data Binding.
It allows to completely decouple the UI from the business logic, making your code easier to test and maintain.
- What is the MVVM Pattern?
- Defining the Model
- Adding the ViewModel
- Binding the View to the ViewModel
- Using Commands instead of Event Handling
- LAB: Adding a View and ViewModel to a WPF Application
Behaviors
“If this then that”, that’s what behaviors are all about. It allows you to set up new functionality for an existing
control in a declarative and reusable way.
- Behaviors
- Triggers
- Built-in Behaviors
- Custom Behavior
Dependency Injection in WPF
When writing code, you have to make sure you are not introducing unnecessary dependencies on other objects.
Dependencies will just cost you on the long run since they are harder to maintain, not easily testable,
exchangeable, … . If you need to depend on another, then depend on the interface. Interfaces describe the
dependency, but do not force it. Now, you don’t want those dependencies to be filled hard coded and this is where
dependency injection (DI) can help you. Dependency injection can help you at runtime dynamically deciding which
implementations to plug into the dependencies.
- What is Tight Coupling and how to prevent it?
- Using Inversion of Control (IoC) containers.
- Constructor and Property injection.
- Microsoft.Extensions.DependencyInjection as an example.
Introducing ASP.NET Web API
This part will show students how to create and consume web services with Web API.
- REST Services
- Architecture
- CRUD Operations
- Feature Overview
Consuming a ASP.NET Web API REST Service with HttpClient
- HttpClient and WebHttpRequest Class
- JSON Serialization and Deserialization
- LAB: Consuming a REST service from WPF
Deploying your WPF Windows Applications
This module will show students how to deploy their WPF application
- Using XCOPY deployment
- Using Click-Once
- Using an Installer
