DataGrid that acts like a ListBox

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

I want a Windows Forms DataGrid that acts in some ways like a ListBox. It
should behave like this:

-> When you click on a cell, the entire row is highlighted (instead of just
the contents of the cell being selected). You cannot edit cells, or even
highlight the contents of individual cells.

-> You cannot change the height of columns.

-> You cannot change the width of rows.

On the other hand, I want the DataGrid to maintain some of it's normal
features: support for multiple columns, column headers, sorting contents by
clicking on column headers, alternating row colors, etc.

How can I do this?

Thanks!
Patrick
 
Hi,

The first requirement is very well covered in the Windows Forms FAQ
available at http://www.syncfusion.com.

As for the rest, these can be implemented by overriding the
OnMouseDown/OnMouseUp methods, doing a HitTest() and preventing further
processing if the HitTest result was DataGrid.HitTestType.RowResize or
DataGrid.HitTestType.ColumnResize.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top