ansoesil’s blog

“Learning is experience. Everything else is just information.” – Albert Einstein

In Depth: Data Binding with Intersoft Presenter for Silverlight – Part1

with one comment

Hi all,

Silverlight 3.0 RTM is released and there are lots of new exciting features including the Microsoft .NET RIA services which give us a new way to perform data binding to Silverlight application.  I’ll cover this area later in other posts, as we still exploring the Silverlight 3.0 so stay tune.

In this post i would like to focus on the current data binding approach that we implement in Intersoft Presenter for Silverlight. There are two ways to perform data binding in Intersoft Presenter for Silverlight:

  1. Bound to Intersoft Data Source control.
  2. Unbound to Intersoft Data Source control.

What does it mean with “Unbound to Intersoft Data Source control” ?

Unbound to Intersoft Data Source control means that your presenter is not attached to any data source control, which required the developer to provide the data through ItemSource property.

InDepth-DataBinding1

You can also use Intersoft Data Source control to populate the ItemsSource to get the data from Astoria Data Service / WCF Data Service / XML.

InDepth-DataBinding2

Since the process is asynchronous, you need to assign the ItemsSource at Selected event as described above.

Using this approach, the presenter will only get the data once and all build-in data operation (filtering / sorting / paging) will be processed using client side operation which mean no data transaction to server again as displayed below.

InDepth-DataBinding3

This approach can be useful, if you can grab all the data at once during the first request. However if you’re dealing with enterprise data where paging is required because the data is too large, its probably best using the “Bound to Intersoft Data Source control” mode so that only partial data is sent from server to client per request (note: using paging approach).

How Bound to Intersoft Data Source control differs with Unbound mode ?

Bound to Intersoft Data Source control means that all the data operation is delegated to Data Source control. The Presenter only need to specify two properties which are DataSourceID and DataMember to point which data service responsible for the Presenter.

By default the all data operation will be requested back from the server through DataSource control, this is design to support the enterprise scenario which most likely will use paging to suppress the data transaction as minimum as possible. However you can also turn the mode into client side operation if you prefer, which force the Presenter to request the data only once at the first call and later all the data operation will be using client side operation as in unbound mode.

InDepth-DataBinding4a

If you check using HTTP Watch or HTTP Fox (for Firefox), you’ll see that there are some data transaction whenever you perform filtering / paging / sorting.

InDepth-DataBinding5

As you can see from the screen shot, bytes sent are relatively small because the data sent is only 20 records per page. You might want to consider this approach if you’re developing enterprise application.

Although Intersoft Presenter has nice feature called Virtual Scroll to overcome scrolling large data issue, its always good idea to consider the data transaction between client and server. This is just one of many approach that you can choose to develop your application.

I’ll discuss more on how to customize the query for data selection, changing the data source with / without structure changed at runtime in part2.

If you want to see the sample code, you can download it from here.

Regards

Andry

Written by ansoesil

July 14, 2009 at 10:13 am

One Response

Subscribe to comments with RSS.

  1. to run the specific samples in this post, change the following code in app.cs

    private void Application_Startup(object sender, StartupEventArgs e)
    {
    // In Depth Data Binding – part 1

    // this.RootVisual = new InDepth_DataBinding_UnboundFromDataSourceControl();
    // this.RootVisual = new InDepth_DataBinding_UnboundFromDataSourceControl_2();
    // this.RootVisual = new InDepth_DataBinding_BoundFromDataSourceControl();
    }

    open one of the commented code.

    ansoesil

    July 22, 2009 at 9:09 pm


Leave a comment