public void Show() { Rect bounds = Window.Current.Bounds; var child = (FrameworkElement)_popupView; _popup = new Popup { Width = bounds.Width, Height = bounds.Height, Child = child, IsLightDismissEnabled = false, ChildTransitions = new TransitionCollection { new PopupThemeTransition {FromHorizontalOffset = 0, FromVerticalOffset = 100} } }; InputPane inputPane = InputPane.GetForCurrentView(); if (inputPane != null) _flyoutOffset = inputPane.OccludedRect.Height; _settings = new PopupSettings { UpdatePositionAction = UpdatePositionDelegate, UpdateSizeAction = UpdateSizeDelegate }; _popupView.InitializePopup(_popup, _settings); UpdatePopup(bounds.Width, bounds.Height); _popup.Closed += PopupOnClosed; if (_settings.ShowAction == null) _popup.IsOpen = true; else _settings.ShowAction(_popup); _weakSizeListener = ReflectionExtensions .CreateWeakDelegate<PopupWrapper, WindowSizeChangedEventArgs, WindowSizeChangedEventHandler>( this, (wrapper, o, arg3) => wrapper.OnWindowSizeChanged(arg3), (o, handler) => ((Window)o).SizeChanged -= handler, handler => handler.Handle); Window.Current.SizeChanged += _weakSizeListener; if (inputPane != null) { _weakInputPaneListener = ReflectionExtensions .CreateWeakDelegate<PopupWrapper, InputPaneVisibilityEventArgs, TypedEventHandler<InputPane, InputPaneVisibilityEventArgs>>(this, (wrapper, o, arg3) => wrapper.OnInputPaneChanged(arg3), (o, handler) => { var pane = (InputPane)o; pane.Hiding -= handler; pane.Showing -= handler; }, handler => handler.Handle); inputPane.Showing += _weakInputPaneListener; inputPane.Hiding += _weakInputPaneListener; } }
public void Dispose() { if (_popup != null) _popup.Closed -= PopupOnClosed; if (_weakSizeListener != null) Window.Current.SizeChanged -= _weakSizeListener; if (_weakInputPaneListener != null) { InputPane pane = InputPane.GetForCurrentView(); if (pane != null) { pane.Hiding -= _weakInputPaneListener; pane.Showing -= _weakInputPaneListener; } } _popup = null; _weakSizeListener = null; _weakInputPaneListener = null; _settings = null; }
public void InitializePopup(Popup popup, PopupSettings settings) { }