private void StartPreviewDragging(Windows.UI.Xaml.Input.PointerRoutedEventArgs e) { _isDraggingPreview = true; _previewPopup = new Popup { Width = _parentGrid.ActualWidth, Height = _parentGrid.ActualHeight }; _previewPopup.IsOpen = true; _previewPopupHostGrid = new Grid { VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch }; _parentGrid.Children.Add(_previewPopupHostGrid); if (_parentGrid.RowDefinitions.Count > 0) Grid.SetRowSpan(_previewPopupHostGrid, _parentGrid.RowDefinitions.Count); if (_parentGrid.ColumnDefinitions.Count > 0) Grid.SetColumnSpan(_previewPopupHostGrid, _parentGrid.ColumnDefinitions.Count); _previewPopupHostGrid.Children.Add(_previewPopup); _previewGrid = new Grid { Width = _parentGrid.ActualWidth, Height = _parentGrid.ActualHeight }; _previewPopup.Child = _previewGrid; foreach (var definition in _parentGrid.RowDefinitions) { var definitionCopy = new RowDefinition { Height = definition.Height, MaxHeight = definition.MaxHeight, MinHeight = definition.MinHeight }; _previewGrid.RowDefinitions.Add(definitionCopy); } foreach (var definition in _parentGrid.ColumnDefinitions) { var w = definition.Width; var mxw = definition.MaxWidth; var mnw = definition.MinWidth; var definitionCopy = new ColumnDefinition(); definitionCopy.Width = w; definition.MinWidth = mnw; if (!double.IsInfinity(definition.MaxWidth)) { definition.MaxWidth = mxw; } //{ // Width = definition.Width, // MaxWidth = definition.MaxWidth, // MinWidth = definition.MinWidth //}; _previewGrid.ColumnDefinitions.Add(definitionCopy); } _previewGridSplitter = new GridSplitter { Opacity = 0.0, ShowsPreview = false, Width = this.Width, Height = this.Height, Margin = this.Margin, VerticalAlignment = this.VerticalAlignment, HorizontalAlignment = this.HorizontalAlignment, ResizeBehavior = this.ResizeBehavior, ResizeDirection = this.ResizeDirection, KeyboardIncrement = this.KeyboardIncrement }; Grid.SetColumn(_previewGridSplitter, Grid.GetColumn(this)); var cs = Grid.GetColumnSpan(this); if (cs > 0) Grid.SetColumnSpan(_previewGridSplitter, cs); Grid.SetRow(_previewGridSplitter, Grid.GetRow(this)); var rs = Grid.GetRowSpan(this); if (rs > 0) Grid.SetRowSpan(_previewGridSplitter, rs); _previewGrid.Children.Add(_previewGridSplitter); _previewControlBorder = new Border { Width = this.Width, Height = this.Height, Margin = this.Margin, VerticalAlignment = this.VerticalAlignment, HorizontalAlignment = this.HorizontalAlignment, }; Grid.SetColumn(_previewControlBorder, Grid.GetColumn(this)); if (cs > 0) Grid.SetColumnSpan(_previewControlBorder, cs); Grid.SetRow(_previewControlBorder, Grid.GetRow(this)); if (rs > 0) Grid.SetRowSpan(_previewControlBorder, rs); _previewGrid.Children.Add(_previewControlBorder); _previewControl = new GridSplitterPreviewControl(); if (this.PreviewStyle != null) _previewControl.Style = this.PreviewStyle; _previewControlBorder.Child = _previewControl; _previewPopup.Child = _previewGrid; //await this.previewGridSplitter.WaitForLoadedAsync(); //this.previewGridSplitter.OnPointerPressed(e); _previewGridSplitter._dragPointer = e.Pointer.PointerId; _previewGridSplitter._effectiveResizeDirection = this.DetermineEffectiveResizeDirection(); _previewGridSplitter._parentGrid = _previewGrid; _previewGridSplitter._lastPosition = e.GetCurrentPoint(_previewGrid).Position; _previewGridSplitter._isDragging = true; _previewGridSplitter.StartDirectDragging(e); _previewGridSplitter.DraggingCompleted += PreviewGridSplitter_DraggingCompleted; }
private void StartPreviewDragging(Windows.UI.Xaml.Input.PointerRoutedEventArgs e) { _isDraggingPreview = true; _previewPopup = new Popup { Width = _parentGrid.ActualWidth, Height = _parentGrid.ActualHeight }; _previewPopup.IsOpen = true; _previewPopupHostGrid = new Grid { VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch }; _parentGrid.Children.Add(_previewPopupHostGrid); if (_parentGrid.RowDefinitions.Count > 0) { Grid.SetRowSpan(_previewPopupHostGrid, _parentGrid.RowDefinitions.Count); } if (_parentGrid.ColumnDefinitions.Count > 0) { Grid.SetColumnSpan(_previewPopupHostGrid, _parentGrid.ColumnDefinitions.Count); } _previewPopupHostGrid.Children.Add(_previewPopup); _previewGrid = new Grid { Width = _parentGrid.ActualWidth, Height = _parentGrid.ActualHeight }; _previewPopup.Child = _previewGrid; foreach (var definition in _parentGrid.RowDefinitions) { var definitionCopy = new RowDefinition { Height = definition.Height, MaxHeight = definition.MaxHeight, MinHeight = definition.MinHeight }; _previewGrid.RowDefinitions.Add(definitionCopy); } foreach (var definition in _parentGrid.ColumnDefinitions) { var w = definition.Width; var mxw = definition.MaxWidth; var mnw = definition.MinWidth; var definitionCopy = new ColumnDefinition(); definitionCopy.Width = w; definition.MinWidth = mnw; if (!double.IsInfinity(definition.MaxWidth)) { definition.MaxWidth = mxw; } //{ // Width = definition.Width, // MaxWidth = definition.MaxWidth, // MinWidth = definition.MinWidth //}; _previewGrid.ColumnDefinitions.Add(definitionCopy); } _previewGridSplitter = new GridSplitter { Opacity = 0.0, ShowsPreview = false, Width = this.Width, Height = this.Height, Margin = this.Margin, VerticalAlignment = this.VerticalAlignment, HorizontalAlignment = this.HorizontalAlignment, ResizeBehavior = this.ResizeBehavior, ResizeDirection = this.ResizeDirection, KeyboardIncrement = this.KeyboardIncrement }; Grid.SetColumn(_previewGridSplitter, Grid.GetColumn(this)); var cs = Grid.GetColumnSpan(this); if (cs > 0) { Grid.SetColumnSpan(_previewGridSplitter, cs); } Grid.SetRow(_previewGridSplitter, Grid.GetRow(this)); var rs = Grid.GetRowSpan(this); if (rs > 0) { Grid.SetRowSpan(_previewGridSplitter, rs); } _previewGrid.Children.Add(_previewGridSplitter); _previewControlBorder = new Border { Width = this.Width, Height = this.Height, Margin = this.Margin, VerticalAlignment = this.VerticalAlignment, HorizontalAlignment = this.HorizontalAlignment, }; Grid.SetColumn(_previewControlBorder, Grid.GetColumn(this)); if (cs > 0) { Grid.SetColumnSpan(_previewControlBorder, cs); } Grid.SetRow(_previewControlBorder, Grid.GetRow(this)); if (rs > 0) { Grid.SetRowSpan(_previewControlBorder, rs); } _previewGrid.Children.Add(_previewControlBorder); _previewControl = new GridSplitterPreviewControl(); if (this.PreviewStyle != null) { _previewControl.Style = this.PreviewStyle; } _previewControlBorder.Child = _previewControl; _previewPopup.Child = _previewGrid; //await this.previewGridSplitter.WaitForLoadedAsync(); //this.previewGridSplitter.OnPointerPressed(e); _previewGridSplitter._dragPointer = e.Pointer.PointerId; _previewGridSplitter._effectiveResizeDirection = this.DetermineEffectiveResizeDirection(); _previewGridSplitter._parentGrid = _previewGrid; _previewGridSplitter._lastPosition = e.GetCurrentPoint(_previewGrid).Position; _previewGridSplitter._isDragging = true; _previewGridSplitter.StartDirectDragging(e); _previewGridSplitter.DraggingCompleted += PreviewGridSplitter_DraggingCompleted; }