This is a migrated thread and some comments may be shown as answers.

Colour Selected Cell Only

1 Answer 74 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mary
Top achievements
Rank 1
Mary asked on 28 Jun 2016, 09:59 AM

Hi,

 

I've been trying to figure out how to get my radgridview to colour/put a border around the selected cell only when the user clicks on it. At the moment, using the following code, the grid draws horizontal borders on the selected row when a cell is selected (image attached).

 

    Private Sub gridView_CellFormatting(sender As Object, e As CellFormattingEventArgs) Handles gridView.CellFormatting

        If Not e.CellElement.IsCurrent AndAlso
            e.CellElement.RowInfo.IsCurrent Then
            e.CellElement.BorderColor = Color.FromArgb(208, 215, 229)
        Else
            e.CellElement.ResetValue(LightVisualElement.BorderColorProperty, ValueResetFlags.Local)
        End If

    End Sub

    Private Sub gridView_RowFormatting(sender As Object, e As RowFormattingEventArgs) Handles gridView.RowFormatting

        e.RowElement.DrawFill = False
        e.RowElement.DrawBorder = False

    End Sub

 

How can I get those lines above and below the row to go away?

Thanks for your help.

1 Answer, 1 is accepted

Sort by
0
Mary
Top achievements
Rank 1
answered on 06 Jul 2016, 10:05 AM
I set the SelectionMode property to 'CellSelect' to fix this.
Tags
GridView
Asked by
Mary
Top achievements
Rank 1
Answers by
Mary
Top achievements
Rank 1
Share this question
or