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.
Unfortunately, activation email could not send to your email. Please try again.

Commit ComboBox Cell Value without First Losing Focus

Thread ID:

Created:

Updated:

Platform:

Replies:

124957 Jul 11,2016 04:54 AM Jul 13,2016 04:48 AM WPF 3
loading
Tags: GridControl
Marco Studer
Asked On July 11, 2016 04:54 AM

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?

Kanimozhi Bharathi [Syncfusion]
Replied On July 12, 2016 08:42 AM

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 


Marco Studer
Replied On July 12, 2016 09:57 AM

Thank you very much, it works perfectly!

Kanimozhi Bharathi [Syncfusion]
Replied On July 13, 2016 04:48 AM

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


CONFIRMATION

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.

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.

;