public void Show() { _page.OrientationChanged += PageOrientationChanged; _popup.WindowClosing += PopupClosing; if (_page.ApplicationBar != null && _hideAppBar) { _appBarVisibility = _page.ApplicationBar.IsVisible; _page.ApplicationBar.IsVisible = false; _appBar = _page.ApplicationBar; } _page.Content.IsHitTestVisible = false; _canClose = false; _popup.IsOpen = true; var storyboard = new Storyboard(); var opacityAnimation = new DoubleAnimation() { To = 1, Duration = new Duration(TimeSpan.FromMilliseconds(300)) }; Storyboard.SetTarget(opacityAnimation, (Border)_popup.Content); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("Opacity")); storyboard.Children.Add(opacityAnimation); storyboard.Begin(); _popup.UpdateLayout(); }
private void PositionWindow() { // TODO: Decouple this method from RadWindow class. if (this.radWindow == null) { return; } if (this.radWindow.ActualWidth <= 0 || this.radWindow.ActualHeight <= 0) { this.radWindow.LayoutUpdated += this.OnWindowLayoutUpdated; return; } if (this.WindowStartupLocation == System.Windows.WindowStartupLocation.CenterOwner && this.Owner != null && (this.Owner.ActualWidth <= 0 || this.Owner.ActualHeight <= 0)) { this.Owner.LayoutUpdated += this.OnWindowOwnerLayoutUpdated; return; } Point parentStart = new Point(this.radWindow.LeftOffset, this.radWindow.TopOffset); Size parentSize = this.GetRootSize(); var radOwner = this.Owner as RadWindow; var windowOwner = this.Owner as Window; if (this.WindowStartupLocation == System.Windows.WindowStartupLocation.CenterOwner) { if ((radOwner != null && radOwner.IsOpen) || (windowOwner != null && windowOwner.IsLoaded)) { parentStart = this.Owner.PointToScreen(parentStart); parentSize = new Size(this.Owner.ActualWidth, this.Owner.ActualHeight); } else if (radOwner != null || windowOwner != null) { throw new InvalidOperationException("Cannot set Owner property to a RadWindow that has not been shown previously."); } } parentStart.Offset(-System.Windows.SystemParameters.VirtualScreenLeft, -System.Windows.SystemParameters.VirtualScreenTop); Rect parentRect = new Rect(parentStart, parentSize); PlacementHelper helper = new PlacementHelper(parentRect, new Size(radWindow.ActualWidth, radWindow.ActualHeight), 0, 0, ApplicationHelper.ApplicationSize, this.radWindow.FlowDirection); Point newLocation = helper.GetPlacementOrigin(PlacementMode.Center); newLocation.Offset(System.Windows.SystemParameters.VirtualScreenLeft, System.Windows.SystemParameters.VirtualScreenTop); radWindow.Left = newLocation.X; radWindow.Top = newLocation.Y; radWindow.UpdateLayout(); }
public static void SetWindowSizeAndLocation(RadWindow window, Rect rectangle) { window.Left = rectangle.Left; window.Top = rectangle.Top; if (window.IsResizing) { window.Width = rectangle.Width; window.Height = rectangle.Height; } window.UpdateLayout(); }