コード例 #1
0
        public void VerifyDefaultsAndBasicSetting()
        {
            TwoPaneView twoPaneView = null;
            UIElement   pane1       = null;
            UIElement   pane2       = null;

            RunOnUIThread.Execute(() =>
            {
                pane1 = new Grid();
                pane2 = new Grid();

                twoPaneView = new TwoPaneView();
                Verify.IsNotNull(twoPaneView);

                // Verify Defaults
                Verify.IsNull(twoPaneView.Pane1);
                Verify.IsNull(twoPaneView.Pane2);
                Verify.AreEqual(TwoPaneViewPriority.Pane1, twoPaneView.PanePriority);
                Verify.AreEqual(TwoPaneViewMode.SinglePane, twoPaneView.Mode);
                Verify.AreEqual(TwoPaneViewWideModeConfiguration.LeftRight, twoPaneView.WideModeConfiguration);
                Verify.AreEqual(TwoPaneViewTallModeConfiguration.TopBottom, twoPaneView.TallModeConfiguration);
                Verify.AreEqual(c_defaultMinWideModeWidth, twoPaneView.MinWideModeWidth);
                Verify.AreEqual(c_defaultMinTallModeHeight, twoPaneView.MinTallModeHeight);

                // Verify basic setters
                twoPaneView.Pane1                 = pane1;
                twoPaneView.Pane2                 = pane2;
                twoPaneView.PanePriority          = TwoPaneViewPriority.Pane2;
                twoPaneView.WideModeConfiguration = TwoPaneViewWideModeConfiguration.RightLeft;
                twoPaneView.TallModeConfiguration = TwoPaneViewTallModeConfiguration.BottomTop;
                twoPaneView.MinWideModeWidth      = 500;
                twoPaneView.MinTallModeHeight     = 700;
            });

            IdleSynchronizer.Wait();

            RunOnUIThread.Execute(() =>
            {
                Verify.AreEqual(pane1, twoPaneView.Pane1);
                Verify.AreEqual(pane2, twoPaneView.Pane2);
                Verify.AreEqual(TwoPaneViewPriority.Pane2, twoPaneView.PanePriority);
                Verify.AreEqual(TwoPaneViewWideModeConfiguration.RightLeft, twoPaneView.WideModeConfiguration);
                Verify.AreEqual(TwoPaneViewTallModeConfiguration.BottomTop, twoPaneView.TallModeConfiguration);
                Verify.AreEqual(500, twoPaneView.MinWideModeWidth);
                Verify.AreEqual(700, twoPaneView.MinTallModeHeight);

                // Verify nullable values
                twoPaneView.Pane1 = null;
                twoPaneView.Pane2 = null;
            });

            IdleSynchronizer.Wait();

            RunOnUIThread.Execute(() =>
            {
                Verify.IsNull(twoPaneView.Pane1);
                Verify.IsNull(twoPaneView.Pane2);
            });
        }
コード例 #2
0
        /// <summary>
        /// Invoked whenever application code or internal processes (such as a rebuilding layout pass) call
        /// ApplyTemplate. In simplest terms, this means the method is called just before a UI element displays
        /// in your app. Override this method to influence the default post-template logic of a class.
        /// </summary>
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (!(inlineBackButton is null))
            {
                inlineBackButton.Click -= OnInlineBackButtonClicked;
            }

            inlineBackButton = (Button)GetTemplateChild(PART_BACK_BUTTON);
            if (!(inlineBackButton is null))
            {
                inlineBackButton.Click += OnInlineBackButtonClicked;
            }

            selectionStateGroup = (VisualStateGroup)GetTemplateChild(SELECTION_STATES);
            if (selectionStateGroup != null)
            {
                selectionStateGroup.CurrentStateChanged += OnSelectionStateChanged;
            }

            twoPaneView = (Microsoft.UI.Xaml.Controls.TwoPaneView)GetTemplateChild(PART_ROOT_PANE);
            if (!(twoPaneView is null))
            {
                twoPaneView.ModeChanged += OnModeChanged;
            }

            detailsPresenter = (ContentPresenter)GetTemplateChild(PART_DETAILS_PRESENTER);

            SetDetailsContent();

            SetMasterHeaderVisibility();
            OnDetailsCommandBarChanged();
            OnMasterCommandBarChanged();

            UpdateView(true);
        }
コード例 #3
0
 private void TwoPaneView_ModeChanged(TwoPaneView sender, object args)
 {
     ConfigurationTextBlock.Text = TwoPaneView.Mode.ToString();
 }
コード例 #4
0
 private void OnModeChanged(Microsoft.UI.Xaml.Controls.TwoPaneView sender, object args)
 {
     UpdateView(true);
 }
コード例 #5
0
        //private void TwoPaneView_ModeChanged(TwoPaneView sender, object args)
        //{
        //    // Remove details content from it's parent panel.
        //    ((Panel)RestaurantsGrid.Parent).Children.Remove(RestaurantsGrid);
        //    // Set Normal visual state.
        //    //Windows.UI.Xaml.VisualStateManager.GoToState(this, "Normal", true);

        //    // Single pane
        //    if (sender.Mode == TwoPaneViewMode.SinglePane)
        //    {
        //        // Add the details content to Pane1.
        //        Pane1Root.Children.Add(RestaurantsGrid);
        //    }
        //    // Dual pane.
        //    else
        //    {
        //        // Put details content in Pane2.
        //        Pane2Root.Children.Add(RestaurantsGrid);

        //        // If also in Wide mode, set Wide visual state
        //        // to constrain the width of the image to 2*.
        //        //if (sender.Mode == Microsoft.UI.Xaml.Controls.TwoPaneViewMode.Wide)
        //        //{
        //        //    Windows.UI.Xaml.VisualStateManager.GoToState(this, "Wide", true);
        //        //}
        //    }
        //}

        private void TwoPaneView_ModeChanged(Microsoft.UI.Xaml.Controls.TwoPaneView sender, object args)
        {
            var m = sender.Mode;
        }