拜托,有人可以帮我吗? 我的代码如下:
private void DGImageList_MouseDoubleClick(object sender, MouseButtonEventArgs e) {
object i = DGImageList.SelectedItem;
//Set the selected row background colour to red
}
答案 0 :(得分:0)
好的,这就是你所需要的:
private void DGImageList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var index = ((DataGrid)sender).SelectedIndex;//
DataGridRow row = (DataGridRow)((DataGrid)sender).ItemContainerGenerator.ContainerFromIndex(index);
row.Background = new SolidColorBrush(Colors.Red);
}
的引用:
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;