Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1015
Keeping a row selected
posted

I have a UltraWinGrid where I have set the RowSelectorHeaderStyle to None so that the row selector column does not show. I have also set the grids SelectTypeRow to Extended in order to allow the selection of multiple rows.

In order to allow the user to select a row, I have them click on another cell and then set the row of the clicked cell to "selected" via the following code:

    Private Sub ugRouting_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ugRouting.MouseClick

        Dim aUIElement As Infragistics.Win.UIElement = ugRouting.DisplayLayout.UIElement.ElementFromPoint(New Point(e.X, e.Y))

        Dim aRow As UltraGridRow = aUIElement.GetContext(GetType(UltraGridRow))

        Dim aCol As UltraGridColumn = aUIElement.GetContext(GetType(UltraGridColumn))

        If aCol.Key = "Status" Then ugRouting.Rows(aRow.Index).Selected = True

This works fine when the user initially selects a row. However, when they select a second row, the Selected property of the first row is somehow changed to False someplace (even before it enters the MouseClick subroutine the second time).

My question is: why is the Selected property being changed to False for the first row, and how can I prevent this from happening.

Thanks for any assistance.