views:

1807

answers:

1

I have a silverlight datagrid with a single editable column. This column has a combo box. To open the combo i have to click on the cell three times. Once to select the row, once to enter edit mode, and once to open the combo.

alt text

IMHO this is really bad UX so I would like the row to enter edit mode when the user does a row click or mouse over and allow the combo to be opened when with a single click.

The row would then drop out of edit mode if the user does a mouse off the row.

Is this possible? What is the best way to approach this?

Thanks, Mark

A: 

Hi Mark,

Simple way: handle DataGrid_MouseLeftButtonUp and make your desired behavior.

void  MyDataGrid_MouseLeftButtonUp(sender , e)
{         
     if (MyDataGrid.SelectedItem != null)   //ensure we have current item
     {

         //set current column
         MyDataGrid.CurrentColumn = MyDataGrid.Columns[4];

        //call begin edit
        MyDataGrid.BeginEdit();

       //now open combobox 
       MyComboBox.IsDropDownOpen = true;   // a.) 
   }
}

I hope you catch the ideea.

a) * here I'm not sure if 100% working. (and, of course, you need a reference to MyComboBox (ComboBox control defined in column template)*

Good luck
rlodina

rlodina
Just out of dumb curiosity, has this been tested as of yet? I ask because I need somewhat similar functionality, but need to be able to navigate the grid using the arrow keys, and then allow the user to, with the start of a keystroke, begin editing without the click, and click that you typically have to do. Thx.
Richard B