The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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,
Luc
P.S. To make things worse, the developer of the original WPF application left our company ;-)
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
LRLuc RoggeFebruary 18, 2011 11:08 AM UTC
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,
Luc
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; } }
MAManikandan Syncfusion Team March 18, 2011 03:43 PM UTC
Hi Luc,
Sorry for the delay caused.
Regarding Query 1:
We are using two different TemplateKey on Data Template Cells in silverlight. 1.CellEditTemplateKey It specifies the CellRenderer while editing
2.CellItemTemplateKey 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.