AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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
AD
Administrator
Syncfusion Team
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