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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Template Column doesn't work in Version 14.4.0.20

Thread ID:

Created:

Updated:

Platform:

Replies:

128314 Jan 13,2017 11:56 AM UTC Jan 16,2017 10:06 AM UTC UWP 3
loading
Tags: SfDataGrid
Alexander Sobotta
Asked On January 13, 2017 11:56 AM UTC

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.




Farjana Parveen Ayubb [Syncfusion]
Replied On 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 


Alexander Sobotta
Replied On 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.




Sivakumar R [Syncfusion]
Replied On 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 


CONFIRMATION

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.

Warning Icon 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.Close Icon

;