Introduction

I started developing applications in .NET, using WinForms and ASP.NET. WinForms was a great improvement over Visual Basic 6. ASP.NET WebForms introduced a form-focused, event-driven user interface model similar to WinForms. A major difference was the way in which the user interface was defined.

Visual Studio offered WYSIWYG design support for both technologies. The key difference was that WinForms user interfaces were represented in procedural C# and ASP.NET WebForms that were built in declarative HTML. I’ve always loved the expressive nature of HTML. Even though I preferred developing user interfaces for the Web, desktop applications seemed to offer more power. I like to have complete access to the computer’s resources.

Microsoft released WPF with the .NET Framework version 3.0. I will admit that there was a bit of a transition for me. WPF was a little intimidating. I had to think about things in a completely different manner. The lessons that I learned went beyond the new controls and events. As I learned about data binding, I began to learn about the Model View View Model design pattern, also known as MVVM.

When Microsoft released Windows 8 and Windows Phone 8, I was thrilled to learn that XAML was one of the language choices. Microsoft also introduced the Windows Runtime libraries, also known as WinRT. WinRT offered APIs to support new devices such as tablets and phones. With the release of Windows 8.1 and Windows Phone 8.1, the ability to create Universal Applications projects enabled developers to create Windows Store and Windows Phone applications that share common code, assets, and XAML UIs between both platforms.

The Universal Application development experience has been improved in Windows 10 to allow you to create one project that can be deployed to both Windows Store and Windows Phone devices. If you are developing for your desktop, tablet, or phone, you can use XAML to design the user’s experience.

Buddy James

What This Book Covers

This book was written with two goals in mind. First, we wanted to cover the XAML-based user interface technologies. The second goal was to introduce some common software development practices and design patterns that are used in the enterprise today. We will also cover some development tools and libraries that you can use to aid you in your work.

Chapter 1: What Is XAML?

This chapter is an introduction to XAML. We explain the difference between declarative and procedural programming. We discuss how XAML development is different than other Microsoft development technologies. There is a brief introduction to the MVVM design pattern and how the data binding capabilities of XAML support the implementation of the pattern.

Chapter 2: Software Craftsmanship

Software development is constantly changing. This chapter discusses agile development methodologies and the problems that they solve. We cover object-oriented design goals and how leading your design by developing unit tests first can assist you in achieving these goals. We cover development teams and requirements gathering in this chapter as well.

Chapter 3: Domain-Driven Design

Programming professionally is more about solving business problems than writing source code. Domain-Driven Design is a set of software design principles that support agile development practices where customer participation is required to ensure that you deliver applications that meet the needs and expectations of your clients. We briefly cover some of the software design principles that are used in Domain-Driven Design.

Chapter 4: Design Patterns

Design patterns offer uniform solutions to common problems in software development. This chapter covers layered architecture and several design patterns to assist you in your development efforts. We present an MVVM example in WPF to illustrate the benefits of design patterns in XAML-based applications.

Chapter 5: Unit Testing

Unit testing can help you reduce the number of bugs that you introduce into your software during development. Writing unit tests can also improve your design by illustrating the ways in which your classes are meant to be used.

Chapter 6: Advanced Unit Testing and Test-Driven Development

This chapter builds on the last one by introducing some of the advanced topics in unit testing. This chapter provides an introduction to mocks and stubs, which allow you to write unit tests that execute in the same way each time, even if your code relies on third-party APIs and components. We cover unit testing in Visual Studio as well as NUnit. There is also an in-depth look at Test-Driven Development.

Chapter 7: Exception Handling and Logging

Exception handling is a fundamental task in .NET development, and it safeguards against unexpected application crashes. It is equally important to record data associated with any exceptions, which will assist with troubleshooting issues that arise in production. This chapter covers the Microsoft patterns and practices Exception Handling Application Block, as well as the Logging application block and its usage within WPF applications. We wrap up the chapter with alternative approaches to handling exceptions and logging within your Windows Store applications.

Chapter 8: The WPF User Interface

This chapter provides an introduction to WPF development using XAML to design your user interfaces. WPF-specific controls and design concerns are covered. We also demonstrate how XAML resources and styles allow you to create a common look and feel across your entire application. The chapter concludes with a detailed discussion on data binding techniques to manage data flow within the application.

Chapter 9: The Windows Phone User Interface

This chapter covers Windows Phone development concepts using XAML and C#. We discuss the basic structure of a Windows Phone Store application and how you can design your application for various screen sizes and page orientations. The various presentation controls are covered, and we show how you can use them to display application content while maximizing screen real estate. We also demonstrate how to display data collections and how to configure the Application Bar.

Chapter 10: The Windows User Interface

Windows Store applications are fundamentally different than desktop-based applications. The user interface design standards promote simple, clean user interfaces that are focused on content. In this chapter, we provide you with the basics you need to get your environment set up for Windows 8.1 development. We also cover topics that are specific to Windows Store applications, such as flyouts, Windows 8.1 contracts, and how to adapt to different layouts.

Chapter 11: Deploying and Maintaining Your Application

The last chapter of the book is dedicated to the deployment and maintenance of your application. Source control best practices are explained, as well as an overview of the popular version control systems, TFS and Git. You will learn how to deploy WPF applications using ClickOnce deployment, as well as how to submit your Windows 8.1 and Windows Phone 8.1 applications to the Windows Store.

Who This Book Is For

This book is for all .NET developers who are interested in developing software using Microsoft’s XAML-based technologies. The book requires a working knowledge of C#. To get the most out of this book, we recommend some experience with at least one XAML-based technology.

The examples in this book were developed using Visual Studio 2012 and Visual Studio 2013. You will need experience designing and compiling applications in Visual Studio to build the example source code. The minimum framework version when developing WPF applications is .NET Framework 3.0. The minimum framework version when developing Windows 8.1 and Windows Phone 8.1 applications is .NET Framework 4.5.1.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset