public void Show() { _popup = new Popup { IsLightDismissEnabled = false }; _popup.SetValue(Canvas.TopProperty, 0); _popup.SetValue(Canvas.LeftProperty, 0); _popup.Loaded += OnPopupLoaded; _popup.Closed += OnPopupClosed; Window.Current.Activated += OnWindowActivated; _popup.ChildTransitions = new TransitionCollection { new PopupThemeTransition() }; Height = PopupHeight; Width = Window.Current.Bounds.Width; Canvas layoutRoot = new Canvas(); layoutRoot.SetValue(WidthProperty, Window.Current.Bounds.Width); layoutRoot.SetValue(HeightProperty, Window.Current.Bounds.Height); layoutRoot.Background = _backgroundBrush; layoutRoot.Children.Add(this); SetValue(Canvas.TopProperty, (Window.Current.Bounds.Height - PopupHeight) / 2); _popup.Child = layoutRoot; _popup.IsOpen = true; _viewModel = DataContext as ViewModelBase; if (_viewModel != null) { _viewModel.OnNavigatedTo(new NavigationArgs(NavigationArgs.NavigationMode.New), ParametersKey); } }
protected void SetViewModel(ViewModelBase viewModel) { ViewModel = viewModel; BindingProcessor.ProcessBinding(ViewModel, this, GetBindingPaths()); }