We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

No documentation/sample about using templates for cells in gridcontrol virtual mode

Thread ID:





98290 Feb 18,2011 03:58 AM Mar 18,2011 11:43 AM Silverlight 3
Tags: GridControl
Luc Rogge
Asked On February 18, 2011 03:58 AM


I asked my developers to port an existing application using SyncFusion's GridControl in virtual mode from WPF to Silverlight.

They are completely lost.

The sample for the virtual mode is simplistic.
There is no sample about setting the styles and templates of cells in QueryCellInfo.
The class reference is just the signature of the types and methods without any explanation - not even a description for most members - basically reflection without any added value.
Without any explanation, we simply don't understand what are template keys, styles, etc.

Our application has quite simple needs:
we have a business model with read-only tabular reports.
We want to display it in a virtual grid, with frozen rows and columns.
For each cell, we want to generate contents from a data template depending on the cell type described in our business model, and data-bind it to some business class instance.
It's a report, so we don't need edit/commit features.
Some data templates may be quite complex (diagrams, charts, etc.) and very different form each other (so we really need different templates).
We have a lot of data (cells), but few cell data templates (less than 10).

Do you have a more elaborate virtual grid control sample involving templates?

Thanks forward,


P.S. To make things worse, the developer of the original WPF application left our company ;-)

Luc Rogge
Replied On February 18, 2011 04:46 AM

Oops, very sorry.

I just figured out the sample solutions initially only shows a few featured samples, not all of them.

I'm now looking at the DataTemplateCellDemo with my developers.

Sorry again,


Luc Rogge
Replied On February 18, 2011 06:08 AM

Well, we have a clearer view now, about the issues when porting our app from WPF to Silverlight.

1) In WPF, we did set GridStyleInfo.CellTemplateKey property.
It doesn't exist in Silverlight.
Is it right to replace it by CellTemplateItemKey?

(we have non-editable report content, so we don't set CellEditTemplateKey)

2) We actually don't want to access the templates directly from the resources, because we have a "Layout" class mapping cell content types to data templates.
So, we directly set CellItemTemplate instead of CellItemTemplateKey.
We saw no sample doing that.
Is there any (performance?) issue when doing that?

3) For an unknown reason, our former WPF developer didn't use the cell type "DataBoundTemplate" (maybe it didn't exist 3 years ago, in WPF?).
He made his own cell type, he did register it with Model.CellModels.Add, and did map it thru the GridCellModel generic to its own implementation of GridVirtualizingCellRenderer.

His custom cell type and/or renderer doesn't work on Silverlight.
Did something change between WPF and Silverlight regarding custom cell types and / or renderers?

I put his code here below. His renderer doesn't seem to do anything special. So we'll likely simply remove it and use the standard cell type "DataBoundTemplate". But I'd like to at least try to understand ;-)

Thanks forward,


internal class CVDDataTemplateCellRenderer : GridVirtualizingCellRenderer
public CVDDataTemplateCellRenderer()
IsFocusable = false;
AllowRecycle = true;

public override void OnInitializeContent(ContentControl uiElement, GridRenderStyleInfo style)
bool found = false;

if (null != style.CellTemplateKey)
DataTemplate dataTemplate = ...;
found = (null != dataTemplate);
if (found)
uiElement.ContentTemplate = dataTemplate;

if (!found)
uiElement.ContentTemplate = style.CellTemplate;

uiElement.Content = style.CellValue;

Manikandan [Syncfusion]
Replied On March 18, 2011 11:43 AM

Hi Luc,

Sorry for the delay caused.

Regarding Query 1:

We are using two different TemplateKey on Data Template Cells in silverlight.
It specifies the CellRenderer while editing

It specifies the CellRenderer on cell load time.

Regarding Query 3:

There is no change between WPf and Silverlight regarding custome cell types and/or renderers. You can use in silverlight as wpf.
If you face any problem in your application, revert us with a sample based on you application along with replication procedure.
This would be helpful for us to serve you.

Please let us know if you have any queries.

Manikandan J R.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.