One of the most important features of Telerik RadGridView for WPF and Silverlight is its performance. Whenever we assume that we have reached its maximum, it appears that we can make it a little bit faster. Digging to the foundations of our grid component we found that the slowest operation has always been the rendering of all visual elements engaged. We focused on finding a way to reduce the number of visual elements for GridViewCell, GridViewRow and TreeListViewRow. The Lightweight templates were born-a special set of simplified styles with limited number of visual elements. We succeeded in preserving the look and feel of GridViewCell, GridViewRow and TreeListViewRow except for their effects and corner radius settings.
Each UI component which offers a great set of functionality and professional looking UI comes with a very complex visual tree. Each visual state is defined by variety of elements, different animations, shadow effects and others visuals. Each interaction with the UI leads to recalculating and re-measuring of its visual tree, which often takes more time than expected.
The default templates of GridViewCell and GridViewRow contain different visual elements for each visual state or feature. There are 9 visual elements for GridViewCell and 12 for each GridViewRow and TreeListViewRow. Part of these numbers are due to the shared codebase between our WPF and Silverlight components. The VisualStateManager requires separate elements in order to animate the same property of the same element in different visual state groups in WPF.
This platform limitation does not have effect when Triggers are used in WPF. This led us to the conclusion that we can get rid of these additional elements and limit the number of visual elements in XAML, as follows:
We separated the VSM logic for WPF and we used Triggers to achieve the desired look and feel. With these changes, our expectations are that the performance during load will be improved by up to 50 percent for WPF and up to 25 percent for Silverlight.
These styles are added to all built-in themes for Telerik WPF and Silverlight UI components. For the use of this blog post we chose Windows8 theme to make the quick presentation.
These styles are defined via the themes of RadGridView and you may include it, via defining simple and pretty basic styles:
You may download a runnable demo for WPF and Silverlight from our GitHub repository, following this link.
Senior Front End Developer
Telerik XAML Team
Copyright © 2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.