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

Edit cell while mouse over

Hello,
I've used standard datagrid and I used this way:

<DataGridTemplateColumn.CellStyle>
     <Style TargetType="{x:Type DataGridCell}">
          <Style.Triggers>
               <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="IsEditing" Value="True" />
               </Trigger>
          </Style.Triggers>
     </Style>
</DataGridTemplateColumn.CellStyle>

How to get a similar effect using SfDataGrid? 

4 Replies

SV Srinivasan Vasu Syncfusion Team June 28, 2017 09:20 AM UTC

Hi Rafal, 
 
Thanks for contacting Syncfusion support. 
 
We have checked your query and you can achieve the requirement by overriding the GridSelectionController. In sample, we have called the BeginEdit method for editing respective GridCell. 
 
Please refer the below code 
 
 
  this.datagrid.SelectionController = new SelectionControllers(this.datagrid); 
 
   public class SelectionControllers : GridSelectionController 
    { 
        public SelectionControllers(SfDataGrid dataGrid) : base(dataGrid) 
        { 
             
        } 
        protected override void ProcessPointerMoved(MouseEventArgs args, RowColumnIndex rowColumnIndex) 
        { 
            base.ProcessPointerMoved(args, rowColumnIndex); 
 
            if (rowColumnIndex.ColumnIndex == 2) 
            { 
                this.DataGrid.SelectionController.MoveCurrentCell(new RowColumnIndex(rowColumnIndex.RowIndex,rowColumnIndex.ColumnIndex)); 
 
                this.DataGrid.SelectionController.CurrentCellManager.BeginEdit(); 
            }             
        } 
    } 
 
 
Please download the sample from the below location. 
 
 
 
Regards, 
Srinivasan 



SV Srinivasan Vasu Syncfusion Team June 28, 2017 09:35 AM UTC

Hi Rafal, 
  
Sorry for inconvenience. 
  
Please download the sample here: 
  
Regards, 
Srinivasan 



RA Rafal June 29, 2017 09:09 AM UTC

Hello Srinivasan,
thank you for Sample but it generate some problems. 

For examples, I can't select one row, then move mouse pointer to interesting cell without changing selection.

I've modified your example to show problem:

https://drive.google.com/file/d/0B_dqnXZHa3PHbVNHczdlakhhbXc/view?usp=sharing


Look at my Video sample with std DataGrid:

https://youtu.be/K6QCULCROZk



SV Srinivasan Vasu Syncfusion Team July 1, 2017 04:37 PM UTC

Hi Rafal, 
 
We have checked your query and we have moved the Selection based on currentcell of SfDataGrid. In sample, we have move the currentcell and invoke BeginEdit method to bring the edit mode while mouse move on SfDataGrid. So, that the selection moved to corresponding datarow based on currentcell. 
 
In sample, you have set AllowRowHoverHighlighting as true to show the Hovers of Highlighting rows. This is the default behavior in our side. 
 
Regards, 
Srinivasan 


Loader.
Up arrow icon