最简单的silverlight的DataGrid行双击事件添加
本人看了很多的行双击事件,觉得都太负载,如:用Timer
,Thread等,于是自己决定写一个简单的,如下
this.DataGrid1.LoadingRow += Grid_LoadingRow;
private void Grid_LoadingRow(object sender, DataGridRowEventArgs e)
{
e.Row.MouseLeftButtonUp += Row_MouseLeftButtonUp;
}
private void Row_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
TimeSpan t = DateTime.Now.TimeOfDay;
if (this.DataGrid1.Tag != null)
{
TimeSpan oldT = (TimeSpan)this.DataGrid1.Tag;
if ((t - oldT) < TimeSpan.FromMilliseconds(300))
{
MessageBox.Show("xxx");
}
}
this.DataGrid1.Tag = t;
}