Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to select a column in the XtraGrid (like in MS Excel)

$
0
0

This example demonstrates how to select the whole column in the XtraGrid. For more information, please review the How to select a column in the XtraGrid (like in MS Excel) Knowledge Base article.

See Also:
Appearances Overview

Question Comments

Added By: Daniel Kaminski at: 8/14/2015 5:53:51 AM    

Hi,
I am trying to implement a drag select option for columns. something similar to what is already implemented for rows.
i.e. when the user drags across the column header I would like the grid to select all rows for the dragged columns.

I used the following code so far, but is not quite what I am looking for, it only works when a column header is clicked. I would like to be able to drag and select multiple columns.

   Private Sub gridView1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles gvJob.MouseDown
       Dim view As GridView = TryCast(sender, GridView)
       Dim hi As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
       If hi.InColumn Then
           SelectCells(view, hi.Column)
       End If
   End Sub
   Private Sub SelectCells(ByVal view As GridView, ByVal column As GridColumn)
       For i As Integer = 0 To column.View.RowCount - 1
           view.SelectCell(i, column)
       Next i
   End Sub

Here is a short video of what I am looking for http://screencast.com/t/pAqDpiYPqt

Added By: Andrew Ser (DevExpress Support) at: 8/14/2015 9:25:30 AM    Hello Daniel,
I see that you posted a solution for this in the How to Select Rows via the Mouse thread. Am I right that you implemented the required functionality?

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>