Esempio n. 1
0
        private void Row_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DateTime    now           = DateTime.Now;
            DateTime    lastClickTime = this.lastClickInfo.Time;
            DataGridRow lastClickRow  = this.lastClickInfo.Row;

            // 直前にクリックされた行が今回クリックされた行と一致し、
            // かつ、クリックされた間隔が一定時間以内に収まっているか?
            if (lastClickRow == sender &&
                (now - lastClickTime).TotalMilliseconds < DoubleClickDureationMilliSeconds)
            {
                // 直前にクリックされた情報を初期化。
                this.lastClickInfo = LastClickInfo.Empty;

                // ダブルクリックイベントを発行
                this.OnDoubleClick(sender as DataGridRow);
            }
            else
            {
                // クリックした行情報を保持しておく
                this.lastClickInfo = new LastClickInfo(now, sender as DataGridRow);
            }
        }
        private void Row_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DateTime now = DateTime.Now;
            DateTime lastClickTime = this.lastClickInfo.Time;
            DataGridRow lastClickRow = this.lastClickInfo.Row;

            // 直前にクリックされた行が今回クリックされた行と一致し、
            // かつ、クリックされた間隔が一定時間以内に収まっているか?
            if (lastClickRow == sender
                && (now - lastClickTime).TotalMilliseconds < DoubleClickDureationMilliSeconds)
            {
                // 直前にクリックされた情報を初期化。
                this.lastClickInfo = LastClickInfo.Empty;

                // ダブルクリックイベントを発行
                this.OnDoubleClick(sender as DataGridRow);
            }
            else
            {
                // クリックした行情報を保持しておく
                this.lastClickInfo = new LastClickInfo(now, sender as DataGridRow);
            }
        }