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

Commit ComboBox Cell Value without First Losing Focus

Hello Syncfusion

I have cells of type "ComboBox" in my GridControl. When I click on them, the menu drops down. If I choose a value, it is only committed after I click on another cell / take the focus away from the ComboBox cell.
Is there a way to commit right there and then when I click the new value, without losing focus first?

How could I achieve that?

3 Replies

KB Kanimozhi Bharathi Syncfusion Team July 12, 2016 12:42 PM UTC

Hi Marco Studer, 
We have analyzed your query and you can achieve your requirement by invoking the LostFocus event of GridControl and call EndEdit method of GridCurrentCell to commit the cell changes when an item is selected in dropdown of Combobox. Please find the code example for your reference. 
grid.LostFocus += grid_LostFocus; 
 
void grid_LostFocus(object sender, RoutedEventArgs e) 
{ 
    if (e.Source != this.grid) 
   { 
      if (grid.CurrentCell.IsEditing) 
      { 
          if (!grid.CurrentCell.Renderer.IsFocused) 
              grid.CurrentCell.EndEdit(); 
      } 
   }   
}            
 
Please find the sample link for your reference, 
Regards 
Kanimozhi B 



MS Marco Studer July 12, 2016 01:57 PM UTC

Thank you very much, it works perfectly!


KB Kanimozhi Bharathi Syncfusion Team July 13, 2016 08:48 AM UTC

Hi Marco Studer, 
Thank you for your update. 
Regards 
Kanimozhi B 


Loader.
Live Chat Icon For mobile
Up arrow icon