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

Clicking a Button in SfDataGrid does not fire Click event until 2nd click

Thread ID:





130623 May 22,2017 06:45 PM UTC May 23,2017 05:16 AM UTC WPF 1
Tags: SfDataGrid
Eric Clum
Asked On May 22, 2017 06:45 PM UTC

I have a Button in a GridTemplateColumn of a SFDataGrid.  When you click it, it seems like it selects the cell first. Then you have to click it again to get the click event to fire.  (The built in DataGrid in Visual Studio does not do this)  Is this the designed behavior and is there a way around this? 
                        <syncfusion:GridTemplateColumn Width="55">
                                    <Button x:Name="ButtonDelete" Click="ButtonDelete_Click" Content="Delete" />

Srinivasan Vasu [Syncfusion]
Replied On May 23, 2017 05:16 AM UTC

Hi Eric,   
Thank you for contact Syncfusion support.   
We have analyzed your query.  You can achieve your requirement by override SetFocus() method in GridCellTemplateRenderer class as like below code sample  
Code Snippet:   
this.datagrid.CellRenderers.Add("TemplateExt"new GridCellTemplateExt());   
public class GridCellTemplateExt : GridCellTemplateRenderer   
    protected override void SetFocus(FrameworkElement uiElement, bool needToFocus)   
        if (!needToFocus)   
In the below sample, we have created the custom column and custom renderer from GridTemplateColumn and focus the element to grid cell.   


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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