PC Review


Reply
Thread Tools Rate Thread

contextMenu & Datagrid

 
 
MDB
Guest
Posts: n/a
 
      22nd Dec 2004
Hello All,

I have a datagrid with multiple rows and columns When a user taps a column
I update the quantity by one and then when they tap and hold, I display a
context menu with Subtract and Quantity displayed. Everything works fine
however, I can not figure out how to tell which of the datagrids
cells(row/column) is selected where the context menu is displayed. Can
anyone help? I have tried DataGrid.CurrentCell however, if the cell is not
highlighted/selected, it doesn't work.

Thanks In Advance


 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      23rd Dec 2004
MDB,

What you want to do is get the coordinates for where the button press
took place. Since I assume you are handling the mouse down event, you
should have no problem finding out these coordinates. Once you do that, you
can pass them through to the HitTest method on the DataGrid, and it will let
you know where on the grid the coordinate applies to (including the row and
column number of the cell, if applicable).

Hope this helps.

"MDB" <nospam> wrote in message
news:(E-Mail Removed)...
> Hello All,
>
> I have a datagrid with multiple rows and columns When a user taps a
> column I update the quantity by one and then when they tap and hold, I
> display a context menu with Subtract and Quantity displayed. Everything
> works fine however, I can not figure out how to tell which of the
> datagrids cells(row/column) is selected where the context menu is
> displayed. Can anyone help? I have tried DataGrid.CurrentCell however,
> if the cell is not highlighted/selected, it doesn't work.
>
> Thanks In Advance
>



 
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
DataGrid and ContextMenu (CF 2) Fred Microsoft Dot NET Compact Framework 1 14th Nov 2007 06:47 AM
DataGrid and ContextMenu problems news.tpi.pl Microsoft C# .NET 0 29th Jul 2005 08:38 AM
Datagrid & contextMenu MDB Microsoft Dot NET Compact Framework 2 27th Dec 2004 07:09 PM
Is it possible to add ContextMenu items to the Standard TextBox ContextMenu??? =?Utf-8?B?TWlrZSBpbiBQYXJhZGlzZQ==?= Microsoft Dot NET Framework Forms 1 15th Mar 2004 07:54 AM
DataGrid Cell ContextMenu David Elliott Microsoft Dot NET Framework Forms 0 28th Aug 2003 04:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:29 PM.