PC Review


Reply
Thread Tools Rate Thread

Can I override DataGrid's mouse events?

 
 
=?Utf-8?B?TXJOb2JvZHk=?=
Guest
Posts: n/a
 
      3rd Jan 2005
Is it at all possible to override the default behavior of a DataGrid when the
mouse is clicked on a row? I am having a problem where I am trying to select
multiple rows in a DataGrid by left-clicking them, but each time I click
another row to add it to the selection the previously added row loses it's
highlighting, so it appears as though only one row is selected at any one
time.



 
Reply With Quote
 
 
 
 
=?Utf-8?B?TXJOb2JvZHk=?=
Guest
Posts: n/a
 
      3rd Jan 2005
Update:

I made my own DataGrid extension and override the onMouseUp and onMouseDown
events. I then put in my own code which is supposed to make it so the user
can select multiple rows by clicking them one by one while holding the CTRL
key (and they all stay highlighted until they de-select them-- much like how
Windows Explorer works)

But now I lost all the other behavior of DataGrid which I want (click column
header to sort, resize columns). Using a .NET Resource tool a guy two
threads up from me suggested (so I can see DataGrid's source) helps alot to
see what DataGrid was doing but I can't simply copy the behavior I want from
these methods because certain properties and methods it uses has private
access.

The only thing that preventing my selection goal from working was one line
of code in the onMouseDown method of DataGrid which resets the selection (so
any previous row loses it's selection once I CTRL + left-click another row) I
wish I can just copy the whole method but comment out that one line but
again, because of access level restrictions I have no such luck.

So is my only choice to reinvent the wheel in regards to the other DataGrid
behavior I need (column resize, sorting) if I want my custom selection
behavior to work?
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you override a forms controlbox events? Flashster Microsoft VB .NET 12 11th Dec 2005 04:08 AM
Capturing datagrid events | Double click and mouse move =?Utf-8?B?Tmljaw==?= Microsoft Dot NET 5 26th Nov 2005 10:33 AM
newbie: datagrid mouse events Dan Microsoft C# .NET 0 23rd Jun 2005 10:22 PM
Override Mouse Events in UserControl Charles Law Microsoft VB .NET 3 18th Feb 2004 05:42 PM
Override vs Events Daisy Microsoft C# .NET 4 10th Jul 2003 09:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:23 PM.