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

Image on column header

It´s possible add an image on header column in sfdatagrid in Xamarin forms?


Look the attachment for details

3 Replies

BS Balasubramani Sundaram Syncfusion Team August 23, 2019 04:37 AM

Hi Rafael,  
 
Thank you for contacting Syncfusion support. 
 
We could able to achieve you requirement of add an image in header column through “HeaderTemplate” support in “SfDataGrid” on each data column. However, we don’t have auto fit support for the data template, so you must set the “HeaderHeightRequest” based on the image height you define in application. 
 
Please refer the following sample and code snippet, 
 
Code Snippet [MainPage.xaml] 
 
<dataGrid:SfDataGrid 
     ...... 
     HeaderRowHeight="100" 
        > 
    <dataGrid:SfDataGrid.Columns x:TypeArguments="syncfusion:Columns"> 
        <dataGrid:GridTextColumn  MappingName="OrderID"  Padding="0,0,0,0"> 
            <dataGrid:GridTextColumn.HeaderTemplate> 
                <DataTemplate> 
                    <StackLayout> 
                        <Image x:Name="headerImage" Source="Right.jpg"  HeightRequest="100" WidthRequest="50"/> 
                    </StackLayout> 
                </DataTemplate> 
            </dataGrid:GridTextColumn.HeaderTemplate> 
        </dataGrid:GridTextColumn> 
        <dataGrid:GridTextColumn  MappingName="EmployeeID"/> 
        <dataGrid:GridTextColumn   MappingName="CustomerID"/> 
    </dataGrid:SfDataGrid.Columns> 
</dataGrid:SfDataGrid> 
 
 
 
We hope this helps. Please let us know, if need any further assistance. 
  
Regards,
Balasubramani Sundaram.
 



RF RAFAEL FELIPE SACOMANI August 23, 2019 06:00 AM

Thanks!! Solve my problem! <3


FP Farjana Parveen Ayubb Syncfusion Team August 25, 2019 09:36 PM

Hi Rafael, 
 
Thanks for the update. 
 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
 
Regards, 
Farjana Parveen A  


Loader.
Live Chat Icon For mobile
Up arrow icon