Overriding DataGrid behaviour

  • Thread starter Thread starter Dmitry Karneyev
  • Start date Start date
D

Dmitry Karneyev

Hi!

I'm using DataGrid in windows form.
I need to implement the following functionality:
- any mouse must select a row according where mouse has been clicked
- context menu must be also availiable by right mouse click

Have you got any ideas?
Thanks for any advice.
 
Dmitry,

The context menu is easy, just create a menu and assign it to the
ContextMenu property of the DataGrid control. To select a complete row, you
can handle the click event of a grid and then use the Select method to
select a particular row. To get the row that was clicked, you can use the
HitTest method to find out where the row is that was clicked on.

Hope this helps.
 
Thanks Nicholas!
That is exact I've been looking for.

"Nicholas Paldino [.NET/C# MVP]" <[email protected]>
ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
Dmitry,

The context menu is easy, just create a menu and assign it to the
ContextMenu property of the DataGrid control. To select a complete row, you
can handle the click event of a grid and then use the Select method to
select a particular row. To get the row that was clicked, you can use the
HitTest method to find out where the row is that was clicked on.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Dmitry Karneyev said:
Hi!

I'm using DataGrid in windows form.
I need to implement the following functionality:
- any mouse must select a row according where mouse has been clicked
- context menu must be also availiable by right mouse click

Have you got any ideas?
Thanks for any advice.
 

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

Similar Threads


Back
Top