What’s in there for WPF Programmers?

The book Professional C# and .NET Core 1.0 covers – as the title says – C# 6 and .NET Core 1.0. However, there’s more. The book is now in it’s 10th edition and always covered actual topics that are relevant for .NET programmers. This is not different for this time. But what’s in there for WPF programmers?

Professional C# 6 and .NET Core 1.0

Overall Goals

The book covers topics that are important for professional programmers using C# and .NET. With this, the book covers the following four parts:

  • The C# Language
  • .NET Core and Windows Runtime
  • Windows Apps
  • Web Applications and Services

Let’s get into the details of these sections.

C# 6 and the .NET Framework

The C# Language covers the syntax features of C#, including collections and asynchronous programming. Of course the C# syntax is important for WPF programmers as well. You can read about new C# 6 features such as the null-conditional operator, string interpolation, expression bodied members, read-only auto properties, the nameof operator, and more.
You can even find a WPF sample application in this section. With the chapter about asynchronous programming, a WPF application is shown to show all the different async patterns available with .NET.

.NET Core and Windows Runtime

.NET Core and Windows Runtime covers different libraries from .NET Core as well as other features. You can read about features of Visual Studio, unit testing and UI testing. The APIs covered are for diagnostics, tasks and parallel programming, synchronization techniques, files and streams, security, networking, composition, XML and JSON, and localization. I’ve made sure that the code compiles both with the new .NET Core as well as the .NET Framework – as far as possible. This makes sure you can use the functionality from WPF as well.

Composition

With the Composition chapter (chapter 26), System.Composition assemblies are used. For easier understanding System.Composition, I show simple console applications. To get a bigger picture after understanding the foundations, you will see WPF and UWP applications that make use of several add-ins, both add-ins just with functionality, and add-ins delivering their own user interface.

Localization

The Localization chapter (chapter 28) covers cultures and resources which are important for WPF, and also shows localizing WPF applications using both XAML and C# code.

Windows Apps

What technology should you use today to create Windows applications? As soon as all your clients are running Windows 10, you can chose the Universal Windows Platform. This allows running your programs on all Windows 10 devices, such as the desktop, the phone, XBox, HoloLens, and more. For many developers, not all the clients are already running Windows 10. That’s why I’m offering both WPF and UWP in this section of the book. The information from the book also helps understanding the differences, and the best way to write WPF applications today for an easy path to UWP in the future. You can also reuse a lot of functionality today, and offer user interfaces with WPF and UWP.

Differences between UWP and WPF are covered in the book Professional C# 6 and .NET Core 1.0

Core XAML

Chapter 29, Core XAML explains the core features of XAML, such as dependency properties, attached properties, markup extensions and routed events. You can read about creating custom depency properties, and learn of the foundations of dependency properties. Routed events are different with UWP compared to the bubbling and tunneling features with WPF. With markup extensions, you will see how you can create your own extensions using WPF.

Styling XAML Apps

Chapter 30, Styling XAML Apps is a huge chapter (> 50 pages) that shows how to draw with shapes, use geometry elements for better performance, use transformations, brushes, define styles and resources, create templates in the form of control templates, data templates, customize items panels, use animations, and control states with the visual state manager.
Several of the brushes are available both with UWP and WPF. However, UWP offers the WebViewBrush that is not available with WPF, and WPF offers RadialGradientBrush, DrawingBrush, and VisualBrush that are not available with UWP. All these brushes are covered in this chapter.
Using control templates, a Button is completely customized to get a new look. Data templates are used to define custom looks for entity objects. Items of the ListView control are customized, and you can also see how the items panel can be customized.

Learn about the magic of creating custom control templates for WPF

In real live nothing appears immediately, and disappears suddenly. With this I always have to think about Star Trek, “beam me up, Scotty”. There’s an animation associated with beaming, this way this feels a lot more natural. Animation with easing functions are covered in the book. Showing animations, you’ll also learn using PathGeometry objects to create a custom chart.

Patterns with XAML Apps

Most bigger WPF applications make use of the MVVM (Model-View-ViewModel) pattern. Using this pattern, you still need to make use of other patterns, e.g. how to find the view-model, and messaging between view-models. All this is covered in Chapter 31, Patterns with XAML Apps.
As both UWP and WPF is important as of today, you also learn about different techniques for code sharing, foundations to implement INotifyPropertyBased, understanding the repository pattern, view-models and commands, using Microsoft.Extensions.DependencyInjection as a dependency injection container, and more.

Windows Desktop Applications with WPF

While many other chapters already cover WPF features, chapter 34, Windows Desktop Applications with WPF is a huge chapter (> 65 pages) completely dedicated to WPF. Simple controls, content controls, items controls, layout controls, triggers, the Ribbon control, TreeView for hierarchical data, using the DataGrid with grouping, live shaping with the ‘CollectionViewSource’… You can also read about specific data binding features for WPF such as multi-binding and priority-binding.

Windows Desktop Applications with WPF is a huge chapter covering WPF-only features.

Creating Documents with WPF

Chapter 35, Creating Documents with WPF is an often missed feature that is offered by this great technology. Here you can learn about creating flow documents and fixed documents, creating XPS documents, and printing. Because creating XPS documents is often a lot easier than creating PDF – but clients still expect to receive PDF although they have a XPS reader – I’m creating first XPS, and then convert this to PDF to fulfill all needs.

Deploying Windows Apps

WPF applications are often deployed using ClickOnce. This technology is covered in Chapter 36, Deploying Windows Apps.

Web Applications and Services

Calling services is important for WPF applications. How to create services, you can read part IV of the book: Web Applications and Services. This part not only covers ASP.NET Web API to create REST services, but also Windows Communication Foundation for SOAP services. Of course I prefer REST services nowadays.
Technologies that can be directly used from WPF to access the database are ADO.NET and Entity Framework Core which are covered in the chapters 37 and 38. Maybe you decide to use these technologies only from the service, and use Entity Framework from there – that’s why I moved the data-access technologies to part 4 of the book.

Summary

There are some books that only cover WPF – but I think Professional C# 6 and .NET Core 1.0 has a huge offering for WPF developers. Probably there’s more in there than with many WPF books. This book covers XAML, styling, resources, templates, data binding, the MVVM pattern, all the different kind of controls, the MVVM pattern and related patterns important on using MVVM, documents with WPF, and all the different technologies important with WPF applications.
I hope you enjoy the book!

Have fun with programming and learning!
Christian

More Information

This article just offered some information what’s covered in Professional C# 6 and .NET Core 1.0 for WPF programmers. You can get more information in my customized workshops.