Esempio n. 1
0
        public void When_Focus_Properties_Set_On_Flyout_Propagate_To_Popup()
        {
            var app = UnitTestsApp.App.EnsureApplication();

            var appContent = new Grid()
            {
                Name = "test"
            };
            var flyoutContent = new Grid()
            {
                Children =
                {
                    new Button()
                }
            };

            var flyout = new Flyout()
            {
                AllowFocusOnInteraction = false,
                AllowFocusWhenDisabled  = true,
                Content = flyoutContent
            };

            var flyoutOwner = new Button()
            {
                Flyout = flyout
            };

            appContent.AddChild(flyoutOwner);

            app.HostView.Children.Add(appContent);

            appContent.Measure(new Size(20, 20));
            appContent.Arrange(new Rect(0, 0, 20, 20));

            flyout.ShowAt(flyoutOwner);

            var popupPanel = flyout.GetPopupPanel();
            var SUT        = popupPanel.Popup;

            Assert.AreEqual(false, SUT.AllowFocusOnInteraction);
            Assert.AreEqual(true, SUT.AllowFocusWhenDisabled);

            // Change values
            flyout.AllowFocusOnInteraction = true;
            flyout.AllowFocusWhenDisabled  = false;

            Assert.AreEqual(true, SUT.AllowFocusOnInteraction);
            Assert.AreEqual(false, SUT.AllowFocusWhenDisabled);
        }
Esempio n. 2
0
        public void When_Placement_Full()
        {
            var SUT = new Grid()
            {
                Name = "test"
            };

            var flyout = new Flyout()
            {
                Placement            = Windows.UI.Xaml.Controls.Primitives.FlyoutPlacementMode.Full,
                FlyoutPresenterStyle = new Style
                {
                    Setters =
                    {
                        new Setter(FrameworkElement.MaxWidthProperty,  double.PositiveInfinity),
                        new Setter(FrameworkElement.MaxHeightProperty, double.PositiveInfinity)
                    }
                }
            };

            var button = new Button()
            {
                Flyout = flyout
            };

            //button.Click;
            flyout.ShowAt(button);

            var presenter = flyout.GetPresenter();
            var panel     = flyout.GetPopupPanel();

            var visibleBounds   = new Rect(0, 0, 410, 815);
            var applicationView = ApplicationView.GetForCurrentView();

            using (applicationView.SetVisibleBounds(visibleBounds))
            {
                panel.Measure(visibleBounds.Size);
                panel.Arrange(visibleBounds);

                Assert.AreEqual(410d, presenter.ActualWidth);
                Assert.AreEqual(815d, presenter.ActualHeight);
            }
        }