コード例 #1
0
ファイル: DialogPage.cs プロジェクト: snipervld/StormXamarin
        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);
            }
        }
コード例 #2
0
ファイル: FragmentBase.cs プロジェクト: VJubert/StormXamarin
 protected void SetViewModel(ViewModelBase viewModel)
 {
     ViewModel = viewModel;
     BindingProcessor.ProcessBinding(ViewModel, this, GetBindingPaths());
 }