Home Forums WinForms controls Xceed Grid for WinForms How to highlight selected row from code?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #14191 |

    I am having a problem making selected rows highlight when using a hierarchical detailgrid display if I perform the selection in code rather than clicking directly on the grid.

    Does anyone have any ideas on how to achieve this with minimum code?

    Background:
    I have an application that uses Grid for Net on the main form to provide user with a read-only summary of their data plus it also is a navigation tool ie. by clicking on the appropriate level of the data it provides the context for the sub-functions to work.

    The grid has 2 modes; mode 1 is a simple single level list in a single grid and mode 2 is a hierarchical view of the data structure using multiple detail grids.

    My problem is that when I refresh the grid I need to re-establish the view as the user last saw it it with respect to sorting, expanded tree, selected rows etc. Now I have some simple routines that now do all this except that on the multi-detailgrid version the selected rows are not highlighted.

    On the single grid view the rows are correctly highlighted as the default blue selectionbackcolor and it you click elsewhere on the grid the highlighting is removed and the new location highlighted. To achieve this I just used: GridControl.SelectedRows.Add(dr)

    With the multiple detailgrids it seem like I can correctly select the correct rows of the detailgrids, but there is nothing visible to the user to show this. If I manually try to set the background colour to show my selection then it is not removed if the user then selects another row.

    Imported from legacy forums. Posted by nufocus (had 2721 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m a little bit surprised, we tested something like :

    gridControl1.SelectedRows.Add( gridControl1.DataRows[ 1 ].DetailGrids[ 0 ].DataRows[ 1 ] );

    And it worked fine, perhaps you should send us a sample reproducing this at matt@xceedsoft.com

    Imported from legacy forums. Posted by Matt (had 3071 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.