Вопрос

Hello I recently changed my Datagrid to a RadDatagrid and I have an even OnMouseDoubleClick but Doesn't quite work anymore. If I can get help towards what other changes I have to make to the code inorder for it to work with a RadDataGrid.

protected void OnMouseDoubleClick(object sender, EventArgs args)  
{  
    if (sender != null)  
    {  
         var grid = sender as DataGrid;  
         if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count  == 1)  
         {  
             ((ContactsGridViewModel) DataContext).Open<PersonViewModel>();  
         }  
    }  
}
Это было полезно?

Решение

It looks like the only change you'll have to make is on this line:

var grid = sender as DataGrid;

You're not dealing with a DataGrid anymore, so that line will return null.

Just cast it to the correct element:

var grid = sender as RadGridView;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top