Ejemplo n.º 1
0
        private void SavedCityInfoDataGrid_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Point         point  = e.GetPosition(SavedCityInfoDataGrid);
            HitTestResult result = VisualTreeHelper.HitTest(SavedCityInfoDataGrid, point);

            if (result == null)
            {
                return;
            }
            Button button = VisualHelper.FindParentOfType <Button>(result.VisualHit);

            _isDragFlag = button == null ? true : false;
        }
Ejemplo n.º 2
0
        private void SavedCityInfoDataGrid_OnDragEnter(object sender, DragEventArgs e)
        {
            Point         point  = e.GetPosition(SavedCityInfoDataGrid);
            HitTestResult result = VisualTreeHelper.HitTest(SavedCityInfoDataGrid, point);

            if (result != null)
            {
                DataGridRow row = VisualHelper.FindParentOfType <DataGridRow>(result.VisualHit);
                if (row == null)
                {
                    return;
                }

                _currentMouseOverItem = row.DataContext as CityInfo;

                e.Effects = _currentMouseOverItem != null ? DragDropEffects.Move : DragDropEffects.None;
            }
        }