Double Click and Silverlight Data Grids

Did a bunch of the chores I needed to do today before we head out to Ottawa tomorrow and then Veronica went to nap for a bit.

So I went back to the next gen version of her application and started to try and deal with some of the performance issues in the new application. I'm not sure where the problem is, whether it is the fact that I'm converting the objects from the native NHibernate model objects to an intermediate DTO, or whether SQL Server Express is actually running slower than SQLite (which is possible, I do believe SQLite is faster on smaller databases and hers is only about 1MB at the moment) or something entirely different.

Anyway, loading the entire list of customers for example was a painful ordeal. I added a data pager, but that only helps for the displaying of data AFTER the WCF service returns it. So, since I had added a filter to the screen recently, I simply made it so that it only attempts to load the data after some sort of filter has been applied. The smaller set of results is ending up in much faster load times (obviously, but still an exciting victory), and it is a fair assumption that if Veronica needs to look-up a customer she knows something that can be filtered on in advance, as I'm sure she isn't digging through 1000+ customers every time she needs to find one.

Once that was implemented, the only thing remaining was an editor. I don't really like the inline editing in the Data Grids. It works well for certain abstractions, but most real world model objects don't look right being edited in a grid. It isn't very intuitive and it can be REALLY easy to accidentally commit a change you didn't want to. So, there was a need for a separate editor screen. And since I like to use well known design paradigms, the ultimate when selecting an item from a list is the almighty double click. And damn was that harder than expected.

I needed to add an event handler on the grid to notify when a row is loading so that I can hijack that event to add an event handler to catch the mouse clicking. But not just any mouse click... no apparently catching the click down gets you nothing, but click up (release) actually fires a usable event. Anyway, eventually got it up and running, end result looks like this (even though you can't "see" the double click events).


Now, it is time to make another half dozen or so of these screens for the other objects, all in all though every thing is looking and running better than the old application provided I do a bit to stop it from trying to load every record simultaneously.

Comments

Popular Posts