Is that possible?

  • Thread starter Thread starter Diego F.
  • Start date Start date
D

Diego F.

I'd like to load a DataGrid and then, when the user taps on the rows an
event is triggered. It's like a kind of button grid. Can I do that or do I
need other component?

Regards,

Diego F.
 
The DataGrid1_Click event is available in CF also. I use it display the
contents of current cell.

ThanQ...
 
Thank you, but I have a problem with this. If I tap on the first row it
works, but when I tap on the second one, the triggered event is the
previous; then if I try again it works properly. I think it's like the event
is launched before selecting the new cell.

Regards,

Diego F.
 
In the MouseDown, you need to perform a HitTest at the X/Y position stored
in the OnMouseDown event.
 
Don't have time right this instant, but here is a C# code snippet and see
the "HitTestInfo" in the VS Help.

protected override void OnMouseDown(MouseEventArgs e)
{
log.Debug("OnMouseDown: Started...");

try
{
HitTestInfo oHit = this.HitTest(e.X, e.Y);
switch (oHitType)
{
case oHitType.RowHeader:
MessageBox.Show("Hit a row header.");
break;
case: oHitType.Cell:
MessageBox.Show("Hit a cell.");
break;
case oHitType.Row:
MessageBox.Show("Hit a row.");
break;
}
}
catch(Exception ex)
{
log.Error("OnMouseDown: Handling selecting a row: ", ex);
throw ex;
}
finally
{
log.Debug("OnMouseDown: ...Finished");
}
}
 
I found this sample a while back. It's doing more than what you're
asking, but it provides great details on how to manipulate and use a
datagrid.

What the sample is doing is: Once the user clicks on a data grid box,
it puts a combobox or a text box there. So follow the code to the part
where it determines what box in the data grid was clicked and you have
what you need.

http://www.opennetcf.org/Forums/topic.asp?TOPIC_ID=245
 
Back
Top