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

How to bind a column asyncronously

HI,

I have a SFDatagrid that has a column like this:

           <Syncfusion:GridImageColumn  HeaderText="Image" MappingName="IconImage"   ShowHeaderToolTip="False" AllowGrouping="False" AllowSorting="False" AllowFiltering="False" AllowEditing="False" Stretch="Uniform" >
            </Syncfusion:GridImageColumn>

The mapped binded property "IconImage" is a ViewModel property that is quite slow, since it has to fetch a binary data from database and dynamically create a Bitmap image, before returning it.
So, I'm wondering if there is a way to mark this property as async. Otherwise the datagrid becomes very slow, waiting for the bitmap creation for every row that's displayed.

It should be very nice to have something similar to the "IsAsync=True" that can be used with the "{Binding}" construct, but it seems it can't be used here.

Can you help me to correctly call this property asyncronously so that the datagrid is not freezed when scrolled ?

Silvio


1 Reply

JG Jai Ganesh S Syncfusion Team May 2, 2016 12:15 PM UTC

Hi Silvio, 
 
You can achieve your requirement for binding the column asynchronously by setting the “IsAsync” property like below, 
 
<syncfusion:GridImageColumn HeaderText="Country" 
                            MappingName="ImageLink" 
                            Padding="2,2,2,2" 
                            TextAlignment="Center" 
                            ValueBinding="{Binding Path=ImageLink, 
                                                                                     Converter={StaticResource stringToImageConverter},IsAsync=True}" /> 
 
 
 
                           (Or) 
 
<syncfusion:GridTemplateColumn HeaderText="ImageLink" MappingName="ImageLink"> 
                            <syncfusion:GridTemplateColumn.CellTemplate> 
 
                                <DataTemplate> 
                                    <Image  Source="{Binding ImageLink,Converter={StaticResource stringToImageConverter},IsAsync=True}"/> 
                                </DataTemplate> 
 
                            </syncfusion:GridTemplateColumn.CellTemplate> 
 </syncfusion:GridTemplateColumn> 
 
 
 
Regards, 
Jai Ganesh S 


Loader.
Live Chat Icon For mobile
Up arrow icon