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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC: Edit the CurrentCell

Thread ID:

Created:

Updated:

Platform:

Replies:

45911 Jun 30,2006 05:23 AM UTC Jul 3,2006 08:34 PM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 30, 2006 05:23 AM UTC

Hi! In a GGC I''d like to have the following behavior: A single click selects the hole row. A DoubleClick Starts the Editing of the doubleclicked Cell. How can this behavior be implemented? Best Regards Falk

Administrator [Syncfusion]
Replied On June 30, 2006 03:03 PM UTC

Hi Falk, This can be achieved by setting the following properties. ++++++++++++++ gridGroupingControl1.TableModel.Options.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell; gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One; ++++++++++++++ Best regards, Madhan

Administrator [Syncfusion]
Replied On June 30, 2006 07:18 PM UTC

Ok, this works. But now the CurrentCell (if not in EditMode) has a white Backcolor and a black Forecolor. But as long as the CurrentCell is not in EditMode, I want it to look like the other Cells of the selected row (black BackColor and White ForeColor) Regards Falk

Administrator [Syncfusion]
Replied On June 30, 2006 10:04 PM UTC

Hi Falk, The property named ListBoxSelectionCurrentCellOptions in TableOptions, using which you can set the current cell behaviour or to have currentcell’s color to be of selection color and while editing to be white color. Please follow the code snippet. ++++++++++++++++++++ private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; if(e.TableCellIdentity.RowIndex == cc.RowIndex && e.TableCellIdentity.ColIndex == cc.ColIndex) { if(cc.IsEditing ) e.Style.BackColor = Color.White; else { e.Style.BackColor = this.gridGroupingControl1.TableOptions.SelectionBackColor; this.gridGroupingControl1.TableControl.RefreshRange(GridRangeInfo.Cell(cc.RowIndex,cc.ColIndex)); } } } ++++++++++++++++++++ Thanks, Madhan

Administrator [Syncfusion]
Replied On July 1, 2006 08:51 AM UTC

This works fine, except for one Column: A Column with the CellType Currency. If I set the CellType to TextBox -> it works. If I set it to Currency -> (in Not-EditMode): Backcolor keeps in the SelectionBackColor-State and the TextColor is Black. (in EditMode): Backcolor keeps in the SelectionBackColor-State and the TextColor is White. Can you solve this problem? Regards Falk

Administrator [Syncfusion]
Replied On July 3, 2006 08:34 PM UTC

Hi Falk, Please try the following code snippet and let us know if this helps. +++++++++++++++++++++++++++++ private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e) { GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; if(e.Inner.RowIndex == cc.RowIndex && e.Inner.ColIndex == cc.ColIndex ) { if(e.Inner.Style.CellType == GridCellTypeName.Currency && !cc.IsEditing) { e.Inner.Style.BackColor = this.gridGroupingControl1.TableOptions.SelectionBackColor; this.gridGroupingControl1.TableControl.InvalidateRange(GridRangeInfo.Cell(cc.RowIndex,cc.ColIndex)); } else if(cc.IsEditing ) { e.Inner.Style.BackColor = Color.White; } else { e.Inner.Style.BackColor = this.gridGroupingControl1.TableOptions.SelectionBackColor; this.gridGroupingControl1.TableControl.RefreshRange(GridRangeInfo.Cell(cc.RowIndex,cc.ColIndex)); } } } private void TableControl_CurrentCellStartEditing(object sender, CancelEventArgs e) { GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; if(cc.Renderer.StyleInfo.CellType == GridCellTypeName.Currency) { GridCurrencyTextBoxCellRenderer cr = cc.Renderer as GridCurrencyTextBoxCellRenderer; GridCurrencyTextBox tb = cr.Control as GridCurrencyTextBox; tb.BackColor = Color.White; this.gridGroupingControl1.TableControl.InvalidateRange(GridRangeInfo.Cell(cc.RowIndex,cc.ColIndex)); } } +++++++++++++++++++++++++++++ Thanks for your patience. Best regards, Madhan

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.

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

;