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

Handling Selection And Deselection of a row

Thread ID:





130067 Apr 19,2017 12:43 PM UTC Apr 21,2017 12:52 PM UTC UWP 1
Tags: SfDataGrid
Asked On April 19, 2017 12:43 PM UTC

 I am using sfDatagrid to show some data of users, above the grid I have a Edit button which is by default in Disable mode. When user selects a row in data grid the Edit button will be Enabled. When user clicks again on same row the button will be Disabled again. Please how to handle this, when clicks on row it should be with some background color and click on the same again background color should be clear to normal.

Thanks in advance

Muthukumar Kalyanasundaram [Syncfusion]
Replied On April 21, 2017 12:52 PM UTC

Hi Murali, 

Thank you for contacting Syncfusion support. 

We have analyzed your query. You can achieve your requirement by overriding the SelectionController class as show like the below code, 

Code Snippet: 

this.dataGrid.SelectionController = new GridSelectionControllerExt(this.dataGrid); 
internal class GridSelectionControllerExt : GridSelectionController 
    public GridSelectionControllerExt(SfDataGrid datagrid) : base(datagrid) 
    private bool isSelectedRow = false; 
    int prevSelectionIndex = 0; 
    protected override void ProcessPointerPressed(PointerRoutedEventArgs args, RowColumnIndex rowColumnIndex) 
        base.ProcessPointerPressed(args, rowColumnIndex);            
        var currentRowIndex = rowColumnIndex.RowIndex; 
        if (currentRowIndex != prevSelectionIndex) 
            if (!isSelectedRow) 
                isSelectedRow = true; 
                isSelectedRow = false; 
            prevSelectionIndex = currentRowIndex; 
            (this.DataGrid.DataContext as UserInfoViewModel).EditButtonVisible = true; 
            isSelectedRow = false; 
            (this.DataGrid.DataContext as UserInfoViewModel).EditButtonVisible = false; 

Please let us know if you have any query. 

Muthukumar K 


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

or the page will be automatically redirected to 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