2
votes

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 http://lh4.ggpht.com/_L9TmtwXFtew/Sw6YursbUmI/AAAAAAAAGlg/QJCLu0K7o_8/image_thumb%5B6%5D.png

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

2

2 Answers

2
votes

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

0
votes

setting datagrid.selectedIndex will fix the issue