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.

GGC: Edit the CurrentCell

Thread ID:





45911 Jun 30,2006 01:23 AM Jul 3,2006 04:34 PM Windows Forms 5
Tags: GridControl
Administrator [Syncfusion]
Asked On June 30, 2006 01:23 AM

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 11:03 AM

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 03:18 PM

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 06:04 PM

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 04:51 AM

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 04:34 PM

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


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.