For the past year, I have led an initiative at my company to use Silverlight 4 and WCF RIA Services on the majority of our user interface projects. While these projects have been largely successful, we began running into serious performance problems when trying to squeeze large amounts of data onto our views. The problem wasn’t fetching the data, but rather scrolling and viewing the data in our DataGrids.
One of the largest optimizations we made was to set the windowless parameter back to false. But the root cause pointed to an overload of the Silverlight visual tree. Simply put, there’s only so much you can show on the screen at once, even with virtualization turned on. With a giant excel-like editable datagrid that sprawls the screen, there’s no getting around visual tree overload (especially when scrolling). We evaluated every commercial SL datagrid on the market, and chose the default SDK DataGrid from MS because it fared really well in our scenario.
In the end, we performed many optimizations to get the product to “acceptable” performance, but this motivated me to begin researching WPF as an alternative. I did a massive comparison of all the different WPF/Silverlight datagrids, and one theme remained the same: WPF has much more visual rendering power than Silverlight. These findings have made me dead-set on trying my best to see if WPF can be the platform-of-choice for major apps going forward, but it turns out that the performance honeymoon was short lived.
As I began to build a prototype in WPF, the giant glaring gaps quickly began to emerge. The first was that WPF doesn’t support RIA Services. This is a huge negative, and unless I find a hack to somehow get a client support for WPF, it will force us back to silverlight. The second big one was the validation story. Notice those “free” beautifully animated popout error messages in the datagrid and dataform controls in Silverlight? These are nowhere to be found in WPF. I have yet to find anyone who has replicated them in WPF, and I haven’t had time to try myself. Also, WPF does not have INotifyDataErrorInfo, so any async validation is going to be far less elegant.
And that isn’t the end. There are other smaller issues that deter me. For instance, WPF does not have Fluid UI like SL4, so there is no clean approach to adding natural animations to your data collections. I was hopeful that Blend’s FluidMoveBehavior would fill the gap, but I haven’t been able to get it working even in the most simple scenarios. Also, the WPF toolkit is in a sad state right now, with no updates since 9 months ago (aside from the Ribbon control). Silverlight is definitely getting more attention in this arena.
I really want to harness the power of WPF, but at this point it feels like Silverlight makes it much easier of an experience for developing LOB applications. With that said, I am still going to forge ahead and give my best shot at trying to make WPF work. But if I had to make a recommendation now, I would say that developers in similar circumstances should go for Silverlight first, while always keeping a hawk’s eye on performance. If your application isn’t doing a ton of CRUD on a remote data source, and thus validation and RIA Services aren’t necessary, then WPF becomes an easier sell.
In the event that I do make some breakthroughs with WPF, I’ll be sure to update this post. Stay tuned…
Pingback: WPF 4 vs. Silverlight 4: Which Do You Choose? - Sam Mueller
We’re in a similar situation in silverlight right now, except we don’t have WPF on the table as an option. At first we were rendering all of the cells as in their “editable” state (textbox, dropdownlists), to resemble excel like you did, but then after switching to just textblocks when not focused on a particular cell (the default datagrid behavior), most performance gripes went away. Are you still having an issue in this scenario?
Also, we are trying to *really* resemble the excel grid style where you always have a new blank row at the end of the datagrid, so you can mass enter new rows easily. Are you doing this? If you are, some more insight into how would be very helpful at the moment.
Good read. I have not used SL4 and RIA Services yet but was recently giving thought to all the current projects we are going to upgrade to either SL 4 or WPF 4. I was going to go the route of WPF but maybe SL 4 or a combination depending upon projects. Why a combination? Because I’m thinking we’ll have the same datagrid issue.
Without knowing what your full architecture is and RIA Services, one problem could easily be that you are going to a web server to retrieve your data. IIS I believe is not multithreaded and could easily be part of your problem.
@Josh
We were using the Telerik GridView at first, but with some customizations like cell-level edit markers and undo buttons. Trying to scroll anywhere in the grid was a nightmare, even on powerful quad-core systems. Switching to the sdk DataGrid definitely helped, but it is still worrisome, especially when we have the need to go even further with displaying tons of data at once. And we haven’t had the need for a new record blank row yet, but it may also be in our near future.
@Chris
Our performance problems are definitely about scrolling through the grid. It seems so simple, but smooth scrolling has a major impact on the perception of performance for our users.
The only problems I have ever had with the standard or Telerik’s GridView is when it is in a container that doesn’t restrict the width or height. This automatically turns virtualization off.
Agree with every word.
I already requested the WPF/RIA team to support WPF, but I received an official respond that it’s not on the roadmap.
The problem with Silverlight, except for the performance, there is also the portability of the server side.
Some times I need to develop a single-client application that interacts with a local SQL CE database. The validation, data-retrieval in WPF is a nightmare compare to Silverlight with WCF RIA.
Please ppl don’t sleep and drive MSFT’s devs nuts until they develop these necessary fetures:
http://goo.gl/idcDi http://goo.gl/KNmJe http://goo.gl/jioPO http://goo.gl/QDYxY http://goo.gl/S8ekJ