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

grid row selection problem

Thread ID:

Created:

Updated:

Platform:

Replies:

51777 Nov 14,2006 08:24 AM UTC Nov 21,2006 11:56 AM UTC WinForms 5
loading
Tags: GridControl
Omry Levy
Asked On November 14, 2006 08:24 AM UTC

Hi there,

I have a grid and i want a row to be selected and show the selection color when the user presses a row.
The problem is that i get the row selected as a whole but the cell get's a different color. (pic attached)

What are the settings,styles and such to achive this ?

p.s
the cells are not editable.

Thanks
0L


badselection.zip

Administrator [Syncfusion]
Replied On November 14, 2006 09:37 AM UTC

Hi OL,

If you want to highlight the current cell, you can handle the PrepareViewSyleInfo event and set the style for the currentcell. Here is a code snippet,

private void gridControl1_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e)
{
GridControl grid = sender as GridControl;
GridCurrentCell cc = grid.CurrentCell;
if( cc.RowIndex == e.RowIndex && e.ColIndex == cc.ColIndex)
{
e.Style.BackColor = grid.AlphaBlendSelectionColor;
e.Style.Borders.All = new GridBorder(GridBorderStyle.Solid);
}
}

Best Regards,
Haneef

Omry Levy
Replied On November 14, 2006 12:45 PM UTC

Haneef thanks for your quick reply,

I dont want to highlight the current cell, i want it to not be highlighted when it is clicked upon !

I've attached a picture and in it you can see that although the row is selected and shows the selection color , the cell shows the selection color when it is clicked, it can not be edited, i want only the row to be selected not the cell

How do i achive that ?

Thanks
0L

Administrator [Syncfusion]
Replied On November 15, 2006 09:17 AM UTC

Hi OL,

Try setting the ListBoxSelectionMode property to SelectionMode.One.

this.grid.ListBoxSelectionMode=SelectionMode.One;

Regards,
Haneef

Omry Levy
Replied On November 19, 2006 09:36 AM UTC

Hi Haneef,

Your suggestion of setting the SelectionMode to One is alreay what i did.

The cell can not be edited, the grid only show data, the problem is that the selected cell changes his color and i want it to appear as the selected row color.

What are the properties that change the current cell colors when it is selected, can i do it from there ?

Please look at the attached image again to understand what the problem is.

Thanks
0L


badselection0.zip

Administrator [Syncfusion]
Replied On November 21, 2006 11:56 AM UTC

Hi OL,

The HighlightCurrentRow ( \Syncfusion\Essential Studio\4.3.0.25\windows\Grid.Windows\Samples\Quick Start\HighlightCurrentRow\ ) browser sample shows you how to highlight the current row in a grid. It avoids the problems that arise as you traverse the various grid states as the old current cell deactivates and the new current cell becomes active. It uses a PrepareViewStyleInfo event handler to actually modify the style of any cell that is in the current row to display a highlighted cell. It uses the CurrentCellDeactivated and the CurrentCellActivated events to force the redraw of the old current row and the new current row so that only the proper row is ultimately highlighted. There are also other event handlers that are shown for other points in the flow sequence that occurs during a current cell move.

Here is a path.
[install path]\Syncfusion\Essential Studio\4.3.0.25\windows\Grid.Windows\Samples\Quick Start\HighlightCurrentRow

Best Regards,
Haneef

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

;