Book Image

Microsoft Silverlight 4 and SharePoint 2010 Integration

By : Gaston C. Hillar
Book Image

Microsoft Silverlight 4 and SharePoint 2010 Integration

By: Gaston C. Hillar

Overview of this book

Silverlight is a powerful development platform for creating engaging, interactive user experiences for the Web, desktop, and mobile applications. Integrating Silverlight RIAs in SharePoint 2010 offers amazing opportunities to combine the power and flexibility offered by SharePoint. It is easy to create great user experiences when you have a step-by-step guide to implement Silverlight 4 applications on SharePoint 2010 sites. This book is not a primer on Silverlight 4 or SharePoint 2010. This book focuses on the integration of Silverlight 4 and SharePoint 2010 and provides step-by-step guidelines for implementing Silverlight RIAs in SharePoint. It is filled with real-world examples that depict the various techniques for interacting with data and services provided by this powerful business collaboration platform, for the enterprise and the Internet. As you sit reading this, you might have already started thinking about the benefits of implementing multiple Silverlight applications in a SharePoint environment. This book will help bring those thoughts to fruition. This book begins with the fundamental concepts of integrating Silverlight 4 with SharePoint 2010, such as the preparation of the development environment to create applications using Silverlight 4 and the addition of one or more Silverlight RIAs to a SharePoint site. Then, it moves on to the SharePoint Silverlight Client Object Model world, using step-by-step examples to combine a Silverlight application and a SharePoint module. It also covers methods to deploy and debug the Silverlight application while it runs as Silverlight Web Part in a SharePoint page. The book teaches you to take advantage of the new features offered by Visual Studio 2010 to browse SharePoint lists. Once the reader has control over the SharePoint Silverlight Client Object Model and its asynchronous operations in Silverlight applications, it is time to access external databases through the new Business Connectivity Services (BCS) and interact with workflows. Then, the book explains to perform CRUD operations by consuming the new SharePoint 2010 WCF Data Services in Silverlight. In the end, you'll learn to utilize Silverlight 4's rich media features to add effects and interactive animations to images and videos, thus offering the final touches to the Silverlight 4 and SharePoint 2010 integration learning experience. By the end of this book, you'll learn to take advantage of the unique features offered by Silverlight in order to create impressive UX that interact with SharePoint 2010.
Table of Contents (12 chapters)
Microsoft Silverlight 4 and SharePoint 2010 Integration
Credits
About the Author
Acknowledgement
About the Reviewers
Preface

Preparing the development environment


We want to take full advantage of modern technologies. First of all, we must install the latest tools and begin working on configurations. Later, we will be able to use our existing knowledge to create different kinds of RIAs for SharePoint 2010, using Silverlight 4 — the newest kid-on-the-block from Microsoft.

Note

Silverlight 4 is backward-compatible with its previous version, Silverlight 3. Therefore, when an example uses a feature found only in Silverlight 4, you will find a note explaining this situation. Most of the examples work for both Silverlight versions. However, we will also take advantage of some of the new features found in Silverlight 4.

The only requirements underpinning the development and integration of RIAs into SharePoint 2010 sites are understanding the basics of the C# programming language, ASP.NET, XAML code, and the Visual Studio IDE. We will cover any other requirements in our journey through the creation of many different kinds of RIAs to run in a SharePoint 2010 site. First, we must download and install various Silverlight development tools. We need Visual C# 2010 Professional, Premium, or Ultimate installed, in order to successfully complete the installations explained in the following section. Visual C# 2010 allows us to choose the desired Silverlight version (for example, version 3 or version 4). The following sections and chapters will show Visual Studio 2010 Ultimate screenshots. If you use other versions, some elements that appear in the screenshots could be different but the steps are all valid for the aforementioned versions.

Setting up the development environment

Follow these steps to prepare the development environment:

  1. 1. Download the following files:

    Application's name

    Download link

    File name

    Description

    Silverlight 4 Tools for Visual Studio 2010

    http://www.microsoft.com/downloads/details.aspx?FamilyID= eff8a0da-0a4d-48e8-8366-6ddf2ecad801& displaylang=en

    Silverlight4_Tools.exe

    We must install Silverlight 4 Tools in order to create Silverlight 4 applications in the Visual Studio 2010 IDE, using XAML and C#. It will co-exist with previous Silverlight SDKs (Software Development Kits). This new version of Silverlight Tools also includes the WCF RIA Services package.

    Silverlight 4 Offline Documentation (in CHM format)

    http://www.microsoft.com/downloads/details.aspx?familyid= B6127B9B-968C-46C2-8CB6-D228E017AD74& displaylang=en

    Silverlight_Documentation.EXE

    We must download and run this file to decompress its content, because we will need access to Silverlight 4 official documentation in due course.

    Expression Blend for .NET 4

    http://www.microsoft.com/downloads/details. aspx?FamilyID= 88484825-1b3c-4e8c-8b14-b05d025e1541& displaylang=en

    Blend_Trial_en.exe

    This tool will enable us to create content that targets Silverlight 4 and to create rapid prototypes with the SketchFlow tool.

    Silverlight Toolkit (Updated for Silverlight 4 compatibility)

    http://codeplex.com/Silverlight

    Silverlight_4_Toolkit_April_2010.msi

    It is convenient to download the latest stable release. This toolkit provides a nice collection of Silverlight controls, components, and utilities made available outside the normal Silverlight release cycle. It will be really helpful to use these controls to provide even more attractive user interfaces. Besides, it includes more Silverlight themes.

  2. 2. Run the installers in the same order in which they appear in the above table and follow the steps to complete the installation wizards.

  3. 3. Once the installations have successfully finished, run Visual Studio 2010 or Visual Web Developer 2010 (or later).

  4. 4. Select File | New | Project... or press Ctrl+Shift+N. Select Visual C# | Silverlight under Installed Templates in the New Project dialog box. You will see many Silverlight templates, including Silverlight Business Application and WCF RIA Services Class Library, as shown in the following screenshot:

Discovering the rich controls offered by the Silverlight Toolkit

Silverlight Toolkit is a Microsoft project offering many rich controls, components, and utilities that can help us to enhance our Silverlight UI (User Interface). As we want to create a very attractive UI for SharePoint, it is convenient to get familiar with its features. Follows these steps to see the controls in action and to change the values for many of their properties.

  1. 1. Select Start | All Programs | Microsoft Silverlight 4 Toolkit April 2010 | Toolkit Samples and your default web browser will display a web page with a Silverlight application displaying a list of the controls organized in ten categories as follows:

    • Controls

    • Data

    • DataForm

    • Data Input

    • DataVisualization

    • Input

    • Layout

    • Navigation

    • Theming

    • Toolkit

    By default, the default.htm web page is located at C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Samples in 64-bit Windows versions.

  2. 2. Click on a control name under the desired category and the right panel will display the control with different values assigned for its properties, creating diverse instances of the control. For example, the following screenshot shows many instances of the Rating control under the Input category.

  3. 3. Click on the buttons shown at the bottom of the web page and you will be able to see both the XAML and the C# code used to create the sample for the control. For example, the following screenshot shows the XAML code for the DataGrid control example, DataGridSample.xaml. You can also click on DataGridSample.xaml.cs and check the C# part. This control appears under the Data category.

Browsing themes with sample controls

Silverlight Toolkit also includes 11 themes that allow us to change and improve the overall look-and-feel for our Silverlight UI. They are:

  • Bubble Creme

  • Bureau Black

  • Bureau Blue

  • Expression Dark

  • Expression Light

  • Rainier Purple

  • Rainier Orange

  • Shiny Blue

  • Shiny Red

  • Twilight Blue

  • Whistler Blue

Click on Theme Browser under the Theming category and you will be able to select one of the themes shown in the previous list to preview the look-and-feel of many controls. The following screenshot shows the preview for the Whistler Blue theme: