How to add buttons inside each cell of a column ?

Hi, 
I want to make a Data Grid with a column that has buttons in it. How to have buttons in each cell of a vertical column ? Please help ? 

3 Replies

AN Ashok N Syncfusion Team December 1, 2017 09:39 AM UTC

Hi Ali,     
     
Thanks for contacting Syncfusion support.    
   
You can achieve your requirement by using GridTemplateColumn. Please refer the below UG and code snippet for more details:   
   
<sfgrid:GridTemplateColumn HeaderText="EmployeeIDMappingName="EmployeeID">   
    <sfgrid:GridTemplateColumn.CellTemplate>   
        <DataTemplate>   
            <Button Text="{Binding EmployeeID}" Clicked="Button_Clicked">   
            </Button>   
        </DataTemplate>   
    </sfgrid:GridTemplateColumn.CellTemplate>   
</sfgrid:GridTemplateColumn>   
   
   
private void Button_Clicked(object sender, EventArgs e)   
{   
    // do your actions here for button click    
}   
   
   
Regards,   
Ashok   



JH Jim Horvath - NO LONGER THERE December 1, 2017 07:38 PM UTC

GridTemplateColumn doesn't appear available in Xamarin.Android without Xamarin.Forms.


AN Ashok N Syncfusion Team December 4, 2017 05:18 AM UTC

Hi Jim, 
 
Thanks for contacting Syncfusion support. 
 
You can load your own custom view in Xamarin.Android using GridColumn.UserCellType property. This has been inherits all the properties of GridColumn. We have prepared the sample by loading Button using UserCellType and is available for download under the following link. 
 
 
 
Regards, 
Ashok 


Loader.
Up arrow icon