Skip to main content
main-content

Über dieses Buch

Silverlight 5 has the potential to revolutionize the way we build business applications. With its flexibility, web deployment, cross-platform capabilities, rich .NET language support on the client, rich user interface control set, small runtime, and more, it comes close to the perfect platform on which to build business applications. It’s a very powerful technology, and despite its youth, it’s moving forward at a rapid pace and is gaining widespread popularity.

This book guides you through the process of designing and developing enterprise-strength business applications in Silverlight 5 and C#. You'll learn how to take advantage of the power of Silverlight to develop rich and robust business applications—from getting started to deployment, and everything in between.

In particular, this book will serve developers who want to learn how to design business applications. It will introduce the patterns you'll use, the issues you’ll face, and how to resolve them. Author Chris Anderson, who has been building line-of-business applications for years, demonstrates his expertise through a candid presentation of how to tackle real-life issues, rather than just avoiding them. Developers will benefit from his hard-won expertise through business application design patterns that he shares throughout the book.

With this book in hand, you will:

Create a fully-functional business application in Silverlight Discover how to satisfy the general requirements that most business applications need Develop a business application framework

Inhaltsverzeichnis

Frontmatter

Chapter 1. Getting Started with Silverlight

Abstract
To start developing with Silverlight, you need to set up your machine with a number of applications and tools. This chapter will walk you through that setup. Then, we’ll take a look at the Silverlight project templates available to you, create a Silverlight application using one of these templates, and explore its structure.
Chris Anderson

Chapter 2. An Introduction to XAML

Abstract
Extensible Application Markup Language (XAML—pronounced zammel) is an XML-based declarative markup language used to represent a hierarchy of objects.
Chris Anderson

Chapter 3. The Navigation Framework

Abstract
One of the issues in the early versions of Silverlight was that when you created a new Silverlight project, you were essentially given a blank slate—with no existing user interface structure or framework to help you get started. This created quite a barrier for creating business applications in Silverlight, which typically contain complex user interfaces with numerous views that the user must navigate between. Therefore, to attempt to create a business application of any size in Silverlight 2, you had to start by creating a user interface framework.
Chris Anderson

Chapter 4. Exposing Data from the Server

Abstract
By their very nature, business applications are highly data-centric applications. Therefore, one of the primary concerns you will have when designing your Silverlight business application is how you will expose data from the server, and then consume that data in your application.
Chris Anderson

Chapter 5. Consuming Data from the Server

Abstract
In Chapter 4, we looked at exposing data from the server, briefly using plain WCF Services and then RIA Services in more depth. It’s now time to switch to the client side and look at consuming data from these services. In this chapter, we’ll briefly look at how you can access data exposed by a WCF Service, before moving on to how you consume data using RIA Services—including querying data and submitting any changes back to the server.
Chris Anderson

Chapter 6. Implementing Summary Lists

Abstract
Summary lists (see Figure 6-1) are designed to enable users to quickly locate and identify a record of a given type among the existing data in the system. After they have found the record, they can then drill down to the record to view it in detail and, potentially, edit it.
Chris Anderson

Chapter 7. Building Data Entry Forms

Abstract
Now that you’ve learned how to retrieve data from the server and display it in the form of a read-only list, you need to learn how to display the data in a form such that the user can modify it and submit the changes back to the server. This chapter will take you through creating a data entry form that enables the user to add, edit, and delete records from the system and submit the changes back to the server.
Chris Anderson

Chapter 8. Securing Your Application

Abstract
In any business application, securing data and operations appropriately so that only approved users have access should be a significant design factor. Not doing so effectively opens the business to threats from snooping competitors, breaches of privacy laws, and even sabotage. Therefore, designing effective security into your application is extremely important. This generally involves validating users’ identities, tracking them and their assigned roles, and restricting their access to approved data and operations accordingly.
Chris Anderson

Chapter 9. Styling Your Application

Abstract
One of the key features of XAML is that it enables exceptional user interfaces to be designed and implemented in Silverlight. When designing the look and feel of your application however, you don’t want to have to customize each control and user interface element individually. This is where style resources come in—they enable you to maintain a core set of common styles to be used throughout your application.
Chris Anderson

Chapter 10. Advanced XAML

Abstract
We covered the basics of XAML in Chapter 2 and expanded on most of those concepts through the chapters that followed. Let’s now look at a few handy advanced features of XAML that you will find very useful when building your user interfaces.
Chris Anderson

Chapter 11. Advanced Data Binding

Abstract
So far in this book, you’ve learned how to bind your user interface controls to objects so that the user can view and edit data exposed by these objects. Instead of data being pushed into these controls, the extensive data binding support provided by XAML enables controls to pull the data into themselves. In other words, the controls are essentially controlling the process of consuming the data. You’ve learned that
  • The object assigned to the DataContext property of a control is inherited down the object hierarchy.
  • There are three different binding modes: OneTime, OneWay, and TwoWay (discussed in Chapter 2). You need to set the mode to TwoWay to update the bound object property via a control in the user interface.
  • You can notify the bindings when bound property values on an object have changed, using the INotifyPropertyChanged interface, discussed in Chapter 7.
  • You can notify the bindings when bound property values (or the bound object itself) are invalid by throwing exceptions, implementing the IDataErrorInfo interface, or by implementing the INotifyDataErrorInfo interface, as discussed in Chapter 7.
  • The ObservableCollection<T> type can be used to maintain items in your collections, which will notify the bound user interface controls when items have been added or removed from the collection so they can update themselves accordingly (discussed in Chapter 6). Alternatively, you can implement the INotifyCollectionChanged interface in your own collection classes to enable them to exhibit the same behavior.
  • You can create a view of a collection by wrapping it in a collection view, enabling the data in the collection to be manipulated (e.g., filtered, sorted, grouped, and paged) without actually modifying the underlying collection (discussed in Chapter 6). Collection views also provide a current record pointer that tracks the current item in the collection, enabling multiple controls bound to the same collection view to be kept synchronized. They also provide the ability to move this pointer and navigate through the items in the collection.
Chris Anderson

Chapter 12. Creating User Controls and Custom Controls

Abstract
When designing user interfaces in any technology, you ideally want to encapsulate the look and behavior of commonly used user interface elements into reusable components that you can use elsewhere in your application, or even in other applications. Creating custom controls also reduces the amount of code required in the code-behind, simplifies the XAML in your views, and helps maintain consistency in your user interface.
Chris Anderson

Chapter 13. The Model-View-ViewModel (MVVM) Design Pattern

Abstract
Few topics surrounding Silverlight are so widely discussed as the Model-View-ViewModel (MVVM) design pattern. This pattern is used by many Silverlight, Windows Phone 7, and WPF developers, and even JavaScript libraries are starting to appear that enable HTML applications to make use of the pattern. The blogosphere is overflowing with posts on this topic, with so many differing and varied opinions on how it should be implemented that you might become a little overwhelmed. Adding to this confusion is the fact that the project templates in Visual Studio do not facilitate using the MVVM design pattern out of the box, and with no information on the amount of prerequisite Silverlight knowledge required to implement it effectively, many developers new to Silverlight shun the pattern until they become more experienced in the technology. However, there is general agreement in the development community that, regardless of how you implement the pattern, doing so is good practice. Developers who implement this pattern invariably say that their code is much better for it.
Chris Anderson

Chapter 14. The Managed Extensibility Framework

Abstract
The Managed Extensibility Framework (MEF) is designed to help you create extensible applications. It can discover loosely coupled components (known as parts) at runtime, and “composes” them together. MEF can provide the following two key benefits to your application:
  • As a simple dependency injection framework, MEF allows parts of your application to be decoupled, with the dependencies resolved at runtime.
  • MEF provides a plug-in framework, helping you to modularize your application and make it extensible.
Chris Anderson

Chapter 15. Printing and Reporting

Abstract
Prior to Silverlight 4, much was made of the fact that Silverlight didn’t have any native printing abilities, and this excuse was often used to back the common belief that Silverlight was not ready for business applications, because printing/reporting is a vital requirement in most business applications. Alternative solutions to work around this omission were implemented that could provide reporting and printing support in Silverlight applications in the meantime, but finally, Silverlight 4 introduced the long-awaited printing functionality developers wanted. Silverlight 5 has gone on to improve this functionality greatly. That said, some of the alternative solutions created before Silverlight implemented printing are still often very viable options for implementing reporting.
Chris Anderson

Chapter 16. Interacting with the Host Operating System

Abstract
Although Silverlight started as a sandboxed platform that ran only within a web browser window, it’s grown to become a mature platform for building applications that inevitably required a certain level of integration and interaction with the host operating system.
Chris Anderson

Chapter 17. Application Deployment

Abstract
After you have developed your application in Silverlight, you then need to ensure that you deliver it in an effective manner to your users. One of Silverlight’s advantages is that it makes it very easy to install and run applications on your end-user’s computer. All that the user needs is a browser and a web connection. With just those two things you can have a “clean” PC up and running with a Silverlight application in a matter of minutes, with both the Silverlight runtime and the application deployed to the user’s machine automatically (with their permission), and with no machine restarts necessary.
Chris Anderson

Backmatter

Weitere Informationen

Premium Partner

    Bildnachweise