Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi!

 

I'm wondering in which order things occur when:

 

- clicking different rows in a datagrid

- moving the "selected" row in a datagrid

 

I guess it's something like this:

 

keyDown/mouseDown

currentCellChanged

keyUp/mouseUp

 

The thing is, I'm actually curious to find out exactly where a row gets selected, not having implemented any extended features in the scenario.

I'm into creating a datagrid which rows gets fully selected, and not just the text in the text boxes. I'm almost there, and the answer to this question will make me through...

 

/Rickard

Posted
The thing is' date=' I'm actually curious to find out [b']exactly where a row gets selected[/b], not having implemented any extended features in the scenario.

I'm into creating a datagrid which rows gets fully selected, and not just the text in the text boxes. I'm almost there, and the answer to this question will make me through...

 

I think you can just use the DataGrid.Select method in the CurrentCellChanged event. For example:

[color=Blue]private void[/color] dataGrid1_CurrentCellChanged([color=Blue]object[/color] sender, System.EventArgs e)
{
[color=Blue]int[/color] rowIndex = dataGrid1.CurrentRowIndex;
dataGrid1.Select(rowIndex);
}

Never ascribe to malice that which is adequately explained by incompetence. - Napoleon Bonaparte
Posted

Thanx for your reply but...

 

I think you can just use the DataGrid.Select method in the CurrentCellChanged event. For example:

[color=Blue]private void[/color] dataGrid1_CurrentCellChanged([color=Blue]object[/color] sender, System.EventArgs e)
{
[color=Blue]int[/color] rowIndex = dataGrid1.CurrentRowIndex;
dataGrid1.Select(rowIndex);
}

 

 

 

I've played with this for a while and one thing I've come up to is to remove all editable controls in the datagrid (not the scrollbars though) and this makes the entire row selected (since I only use grid to show data, not to enter data). But my task right now is to make the grid work like a standard window list - e.g. MS Outlook "message list"... This means I have to handle control/shift click, using arrows (with shift/controol also) and combinations of them...

 

/Rickard

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...