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.

How to highlight the whole current row

Thread ID:





18669 Sep 7,2004 06:41 AM Sep 9,2004 02:39 AM Windows Forms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On September 7, 2004 06:41 AM

In GridGroupingControl, I want to highlight the whole current row when click on a cell. I use following code in DataBoundGrid''s click event to highlight current row. _grid.Selections.Clear(); _grid.Selections.SelectRange(GridRangeInfo.Row(currentRowIndex),true); _grid.Refresh(); TIA

Administrator [Syncfusion]
Replied On September 7, 2004 07:43 AM

Hi, instead of SelectRange you can handle TableControlPrepareViewStyleInfo. Example: this.gridGroupingControl1.TableControlPrepareViewStyleInfo += new GridTableControlPrepareViewStyleInfoEventHandler(gridGroupingControl1_TableControlPrepareViewStyleInfo); private void gridGroupingControl1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e) { GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.Inner.Style; if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell) { Record r = style.TableCellIdentity.DisplayElement.ParentRecord; if (r.IsCurrent) { e.Inner.Style.BackColor = SystemColors.Highlight; e.Inner.Style.TextColor = SystemColors.HighlightText; } } } Stefan

Simon Spruzen
Replied On September 9, 2004 02:39 AM

Or just set: gridControl.ListBoxSelectionMode = System.Windows.Forms.SelectionMode.One; and make sure gridControl.AllowSelection has AlphaBlend option checked for a nicer visual look.


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.