in
Forums
Blogs
DevExpress.com
Client Center
Support Center
DevExpress Channel

The One With

Free Silverlight DataGrid is Fast!

What's New in 8.2.5

If you have not downloaded the latest version of the AgDataGrid you must! This release (8.2.5) includes some significant changes.

The grid is much much faster now. W00t!. (I know some of you have been waiting for this.) This was not an easy task. The problem is that any change to the VisualTree is an expensive operation. The less you touch it, the faster things get. With that in mind, the internal StackPanel used by the grid to present the actual data rows, and the internal RowsController have been completely rewritten. Now in 8.2.5, instead of rebuilding the tree as the grid is being scrolled, existing elements are reused and updated with values according to the data source.

Additionally, a new property was added: DelayScrolling. DelayScrolling helps a lot if you have a lot of records per data page. So as you scroll via the scroll bar, the data will be scrolled via a ticker, thus removing the "scroll delay" effect.

While we are on the topic of what's new, I should mention that after you upgrade, you will need to change your namespace references as some of them have been renamed.

  • DevExpress.Windows.Data -> DevExpress.AgDataGrid.Data
  • DevExpress.Windows.Data.Helpers -> DevExpress.AgDataGrid.Data.Helpers
  • DevExpress.Windows.Controls.Internal -> DevExpress.AgDataGrid.Internal
  • DevExpress.Windows.Controls -> DevExpress.AgDataGrid
  • DevExpress.Windows.Controls.Tests -> DevExpress.AgDataGrid.Tests
  • DevExpress.Windows.Controls.UIAutomation -> DevExpress.AgDataGrid.UIAutomation

You can download the latest version by visiting your Client Center area https://www.devexpress.com/ClientCenter/, or if you have not registered for the Free Silverlight Controls yet you can do so at http://devexpress.com/Products/NET/Controls/Silverlight/Register/.

Now that I got you all excited, I want to share some of the AgDataGrid tips and techniques. Namely, I want to cover the master-details scenarios. What's a RIA without the master-detail data right? :)

Master-Detail data with 2 Grids

This one is easy. Imagine 2 grids side by side one displaying customer records and the other one is showing "orders". The orders change as you scroll through the customers.

Download master records: (Note: I am using AgXPO to fetch the data from the server)

XPQuery<Customer> source = new XPQuery<Customer>(unitOfWork);

var query =
    from t in source
    select t;

customersGrid.DataSource = query.ToList<Customer>();

then in the FocusedRowChanged event of the customers data grid:

this.customersGrid.FocusedRowChanged += 

     new FocusedRowChangedEventHandler(Customers_FocusedRowChanged); 

simply:

XPQuery<Order> source = new XPQuery<Order>(unitOfWork);
var query =
    from t in source
    where t.CustomerID == customerId
    orderby t.OrderDate descending
    select t;

ordersDataGrid.DataSource = query.ToList<Order>();

Master-Detail data with 1 Grid

This one is easy as well. We can use the preview row feature of the AgDataGrid to display the detail records, and fetch the data for it in the PreviewStatus event. So if the grid is bound to the list of

public class Customer : PersistentBase {
    public Customer(Session session)
        : base(session) {
    }

    IList<Order> _orders;
    [NonPersistent]
    public IList<Order> Orders {
        get { return _orders; }
        set { _orders = value; }
    }
}

Then in the PreviewStatus event, we'll fetch all orders into the Orders property and in the data template for the PreviewRow we'll make sure that we bind to this list.

<local:AgDataGrid.PreviewTemplate>
    <DataTemplate>
        <local:AgDataGrid DataSource="{Binding Orders}">
    </DataTemplate>
</local:AgDataGrid.PreviewTemplate>

I have used both of these techniques in a little Northwind explorer app.

 image

You can download the full source for it here

 

Cheers

Azret

Published Feb 10 2009, 08:36 PM by Azret Botash (Developer Express)
Technorati tags: Silverlight, AgDataGrid, AgXPO

Comments

 

Linton said:

Thank you for the post Azret.

To clarify: You mention the version as 8.2.5, do you mean 8.3.5? If yes, checking the client center link today 8.3.5 has not yet been posted. Do you have an ETA?

TIA, Linton

February 11, 2009 10:30 AM
 

Azret Botash (Developer Express) said:

Hi Linton,

No it's 8.2.5. You should see 2 downloads in the client center.

AgDataGrid Suite v.8.2.5

AgMenu Suite v.8.2.5

--

Azret

February 11, 2009 11:35 AM
 

Chris W Walsh said:

Azret, love the caching mechanism in your Database Class

Although i'm not a fan of ThreadPool.QueueUserWorkItem, i've been using BackgroundWorkers and hooking their events to show / hide waiting panels while the workers are doing database get / sets.

February 11, 2009 4:55 PM
 

Tolga Erdogus said:

AgXPO?  What's the transport layer for that?  Is it remoting or something like Ado.net Data Services?

And when can we get hold of that sweetness?  Or is it already there and I have been sleeping at the wheel?

February 12, 2009 8:25 AM
 

Azret Botash (Developer Express) said:

Tolga, AgXPO is a lightweight port for Silverlight of our XPO framework. devexpress.com/.../ORM

In the examples, I am using WCF as a transport, but you can use straight up sockets if you wish to.

--

Azret

February 12, 2009 12:31 PM
 

Silverlight Travel » Free Silverlight DataGrid is Fast said:

Pingback from  Silverlight Travel » Free Silverlight DataGrid is Fast

February 13, 2009 4:21 AM

Leave a Comment

(required)  
(optional)
(required)  
Verification code: Required
   
Add
Copyright © 1998-2010 Developer Express Inc.
ALL RIGHTS RESERVED