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. Image for the cookie policy date

Template Column doesn't work in Version 14.4.0.20

Hello,

I updated Syncfusion UWP from 13.3.0.7 to 14.4.0.20.

Now i get this error message when running the app: Cannot add instance of type 'Syncfusion.UI.Xaml.Grid.GridTemplateColumn' to a collection of type 'Syncfusion.UI.Xaml.Grid.Columns

Why insctance of a TemplateColumn cannot be added to the Columns of the Grid? 
Here's the code of my Template Column:

 <SfGrid:GridTemplateColumn.CellTemplate>
               <DataTemplate>
                         <Image Source="{Binding ImagePreview, Converter={StaticResource ResourceKey=ByteArrayToImageConverter}}"/>
               </DataTemplate>
  </SfGrid:GridTemplateColumn.CellTemplate>

When i roll back to 13.3.0.7 it works fine. 

Regards 
A.S.




3 Replies

FP Farjana Parveen Ayubb Syncfusion Team January 16, 2017 08:57 AM UTC

Hi Alexander, 

Thank you for contacting Syncfusion support. 
 
We have checked the reported issue ”TemplateColumn is not loaded in SfDataGrid in Syncfusion version 14.4.0.20”,  by binding the BitmapImage as a Source for Image in TemplateColumn, but we are unable to reproduce the issue at our end. Could you please share the ByteArrayImageConverter code and ByteArray code which is bounded in ViewModel, otherwise could you please modify the below sample which will help us to provide you the better solution. 
 
Please refer the sample in the below link that we have tried in our end. 
 
Sample Location: UWP_TemplateColumn_Sample
 
 
 
Regards, 
Farjana Parveen A 



AS Alexander Sobotta January 16, 2017 09:40 AM UTC

Hello,

Thank you for the sample application, it helped me to find the error.

In your sample application you have set "MappingName" at the templatecolumn. 
I thaught it's not nessecary to set a mappingname because the binding inside defines it and in 13.3.0.7 that was working. 
What if I want to set more that one binding inside the template column? What is the correct MappingName then?

This is the working code with 14.4.0.20 now, defining "ImagePreview" two times:

                <SfGrid:GridTemplateColumn HeaderText="Preview" MappingName="ImagePreview" AllowFiltering="False" AllowSorting="False" AllowGrouping="False">
                    <SfGrid:GridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding ImagePreview, Converter={StaticResource ResourceKey=ByteArrayToImageConverter}}"/>
                        </DataTemplate>
                    </SfGrid:GridTemplateColumn.CellTemplate>
                </SfGrid:GridTemplateColumn>

Regards

A.S.





SR Sivakumar R Syncfusion Team January 16, 2017 10:06 AM UTC

  
Hi Alexander, 
 
Yes, You have to set MappingName to the column. It is mandatory. You can set MappingName as any property in underlying data object. Based on the MappingName property of column data operations like sorting, grouping and filtering will be performed. 
 
It will also bind template based on MappingName of the column. Refer the below documentation link for more information, 
 
Thanks, 
Sivakumar 


Loader.
Up arrow icon