예제 #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            string        parameterKey = e.Parameter as string;
            ViewModelBase viewModel    = DataContext as ViewModelBase;

            if (viewModel != null)
            {
                viewModel.OnNavigatedTo(NavigationHelper.FromArgs(e), parameterKey);
            }
        }
예제 #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            NavigationArgs args          = NavigationHelper.FromArgs(e);
            string         parametersKey = null;

            if (NavigationContext.QueryString.ContainsKey("key"))
            {
                parametersKey = NavigationContext.QueryString["key"];
            }
            ViewModelBase vm = DataContext as ViewModelBase;

            if (vm != null)
            {
                vm.OnNavigatedTo(args, parametersKey);
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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);
            }
        }