예제 #1
0
        private void HandleResizerKeyDown(GridResizer resizer, KeyEventArgs e)
        {
            DragDeltaEventArgs args = null;

            if (resizer.Orientation == Orientation.Horizontal)
            {
                if (e.Key == Key.Up)
                {
                    args = new DragDeltaEventArgs(0, -1);
                }
                else if (e.Key == Key.Down)
                {
                    args = new DragDeltaEventArgs(0, 1);
                }
            }
            else
            {
                if (e.Key == Key.Left)
                {
                    args = new DragDeltaEventArgs(-1, 0);
                }
                else if (e.Key == Key.Right)
                {
                    args = new DragDeltaEventArgs(1, 0);
                }
            }

            if (args != null)
            {
                e.Handled = true;
                Resizer_DragDelta(resizer, args);
            }

            if (e.Key == Key.Delete)
            {
                int resizerIndex = AdornerLayer.Children.IndexOf(resizer);
                var resizerData  = _data.Resizers[resizerIndex];

                var indices = new List <int>(resizerData.PositiveSideIndices);
                indices.AddRange(resizerData.NegativeSideIndices);
                _data.DoMerge(indices);
                SetupUI();
                e.Handled = true;
            }
        }
예제 #2
0
        private void MergeClick(object sender, RoutedEventArgs e)
        {
            MergePanel.Visibility = Visibility.Collapsed;

            var selectedIndices = new List <int>();

            for (int zoneIndex = 0; zoneIndex < _data.Zones.Count; zoneIndex++)
            {
                if ((Preview.Children[zoneIndex] as GridZone).IsSelected)
                {
                    selectedIndices.Add(zoneIndex);
                }
            }

            ClearSelection();
            _data.DoMerge(selectedIndices);
            SetupUI();
        }