Register   |   Login

 

Spark Your Solution

 Scott's Technology Blog Minimize

Sep 16

Written by: Scott Davis
9/16/2008 8:23 AM

In August, I presented at the Twin Cities Silverlight User Group.  Here was the synopsis.


Silverlight introduces a whole new realm of possibilities when we think about pushing line of business applications to the web. No longer is there a need to settle for the simple interfaces and limited usability of HTML. When we think about line of business applications, nearly all involve heavy use of data. Silverlight development leverages many of the patterns we would normally see when building distributed desktop applications. Unfortunately many of us who have spent years building traditional web applications may have lost, or never even gained, some of those skills. This session will focus on some of the fundamentals of asynchronous data access and update notifications. We’ll explore some data binding concepts in Silverlight with controls such as the datagrid, and implementations with the ObservableCollection class. Finally, we’ll explore tips for reducing network bandwidth for data transfers, and building/accessing a localized data store using Linq for objects.

Scott is a seasoned consultant with nearly a decade of consulting experience on both the Microsoft and Java platforms, involving mostly web application development. Scott began working with Silverlight in the 1.1 Alpha. With experience in desktop, mobility, reporting , and database design/development, Scott brings a broad range of technology experience to any project. He has held as many as 10 concurrently active premier technology certifications during his consulting years, and is also a PMP certified project manager. Scott is currently the owner and principal consultant for Ignition Point Solutions. Recent projects for Scott include writing Silverlight 2.0 and Windows Mobile 6 applications, as well as doing executive-level IT strategy and planning consulting.


Below is a link to the sample code that was created and reviewed during the presentation.  This sample code demonstrates how Silverlight is hosted in a standard HTML page and an ASPX page.  WCF integration with Silverlight is demonstrated in this application that polls the server on an interval for updates and only returns updates to the Silverlight control that are new since the last time the client made an update request.  Data binding in the Silverlight UI is demonstrated using a single data context class that holds all the data for the UI (fields and lists stored in the same context class).  Binding in the Silverlight data grid is demonstrated using template columns to show two buttons in the grid.  One button’s graphical display is affected with simple binding, by affecting the opacity of the black button.  The other button uses a converter to change the color, by converting a primitive into an object.  Observable collections and INotifyPropertyChanged are used to show how Silverlight automatically updates its display when changes in the bound data context are made.  Finally LINQ to objects is demonstrated for creating and using a localized data store in Silverlight.

Left for the user to complete: 

  • Find the TODO in the Page.xaml.cs file and change the code that replaces the entire list for the grid, with code that updates individual values so that the INotifyPropertyChanged code in the SLMessage class is actually leveraged.
  • Find the TODO in the Message.cs class directing you to use System.Runtime.Serialization decorators [DataContract]  [DataMember] to change the fields names during serialization.  This will reduce network bandwidth usage by making message size a little smaller.     
  • Review other TODO comments

 

Directions:

  • Open the solution file and run
  • Type a message text and click save
  • Type another message text and click save
  • Click either link to open the page containing the Silverlight control in a new window
  • Return to the first window and add another message, wait a few seconds and watch the new message appear in the Silverlight window
  • Return to the first window and change the priority of the message and watch how the Silverlight display is impacted

Get the demo code

Tags:

Your name:
Title:
Comment:
Add Comment    Cancel  

  
 Blog Dates Minimize

 Print   
 Search Minimize

 Print