public void ShowFlyout(FrameworkElement element, FlyoutPlacementMode placement)
 {
     isOkPress               = false;
     this.placeToShow        = element;
     addDeckFlyout.Placement = placement;
     addDeckFlyout.ShowAt(placeToShow);
 }
Exemple #2
0
        public void ShowDotoFlyout(FrameworkElement frameworkElement, FlyoutPlacementMode flyoutPlacement,
                                   string contentTemplate = "", UserControl flyoutControl = null)
        {
            Flyout flyout = new Flyout();

            if (flyoutControl != null)
            {
                flyout.Content = flyoutControl;
            }
            else
            {
                flyout.Content = new ContentPresenter
                {
                    Content         = viewModel,
                    ContentTemplate = (DataTemplate)App.Current.Resources[contentTemplate]
                };
            }

            flyout.Placement = flyoutPlacement;
            if (frameworkElement is Button)
            {
                ((Button)frameworkElement).Flyout = flyout;
            }
            flyout.ShowAt(frameworkElement);
        }
        private static void PlacementOnChang(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            NumberPicker Con = (NumberPicker)sender;

            FlyoutPlacementMode fpm = (FlyoutPlacementMode)e.NewValue;

            switch (fpm)
            {
            case FlyoutPlacementMode.Top:
                Con.flyout.Placement            = FlyoutPlacementMode.Top;
                Con.flyout.FlyoutPresenterStyle = (Style)Con.Resources["FlyoutPresenterTop"];
                break;

            case FlyoutPlacementMode.Bottom:
                Con.flyout.Placement            = FlyoutPlacementMode.Bottom;
                Con.flyout.FlyoutPresenterStyle = (Style)Con.Resources["FlyoutPresenterBottom"];
                break;

            case FlyoutPlacementMode.Left:
                Con.flyout.Placement            = FlyoutPlacementMode.Left;
                Con.flyout.FlyoutPresenterStyle = (Style)Con.Resources["FlyoutPresenterLeft"];
                break;

            case FlyoutPlacementMode.Right:
                Con.flyout.Placement            = FlyoutPlacementMode.Right;
                Con.flyout.FlyoutPresenterStyle = (Style)Con.Resources["FlyoutPresenterRight"];
                break;

            //  case FlyoutPlacementMode.Full:
            //   break;
            default:
                break;
            }
        }
Exemple #4
0
        public async void ShowFlyout(FrameworkElement showAt, FlyoutPlacementMode placeAt)
        {
            var files = await GetBackUpFiles();

            if (files == null)
            {
                return;
            }

            foreach (var file in files)
            {
                var fileProperties = await file.GetBasicPropertiesAsync();

                backUpFiles.Add(new BackupFilesInformation()
                {
                    DateModified       = fileProperties.DateModified.LocalDateTime.ToString(),
                    DateModifiedInLong = fileProperties.DateModified.ToUnixTimeSeconds(),
                    Name = file.Name
                });
            }

            backUpFiles.Sort((x, y) => { return(-x.DateModifiedInLong.CompareTo(y.DateModifiedInLong)); });
            fileListView.DataContext       = backUpFiles;
            databaseBackupFlyout.Placement = placeAt;
            databaseBackupFlyout.ShowAt(showAt);
        }
        private void AddCommandBinding_OnExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            DateTime?           date           = DateTime.Today;
            ExpenseCategory     category       = null;
            FrameworkElement    objectToShowAt = PagesList;
            FlyoutPlacementMode placement      = FlyoutPlacementMode.Right;

            // new expense flyout
            var listFrame = new Frame();
            var flyout    = new Flyout
            {
                Content   = listFrame,
                ShowMode  = FlyoutShowMode.Standard,
                Placement = placement
            };

            flyout.Closed += (s, o) => RefreshPage();

            switch (PagesList.SelectedIndex)
            {
            case 1:      // table view
                var listPageInTablePage = (ListPage)((TablePage)RootFrame.Content).Table.listPageElement;
                if (listPageInTablePage != null)
                {
                    date = listPageInTablePage.ExpensesDatePicker.SelectedDate;
                    if (date == null)
                    {
                        date = DateTime.Today;
                    }
                    category       = (ExpenseCategory)listPageInTablePage.CategoriesComboBox.SelectedItem;
                    objectToShowAt = listPageInTablePage;

                    flyout.Closed += (s, o) => listPageInTablePage.FillPage();
                }
                else
                {
                    date = DateTime.Today;
                }

                break;

            case 2:     // list view --> new expense for selected date/category
                var listPage = (ListPage)RootFrame.Content;
                date           = listPage.ExpensesDatePicker.SelectedDate;
                category       = (ExpenseCategory)listPage.CategoriesComboBox.SelectedItem;
                objectToShowAt = listPage.AddButton;
                placement      = FlyoutPlacementMode.Bottom;
                break;
            }

            Expense expense     = null;
            var     expensePage = new ExpensePage(flyout, expense, category, date);

            listFrame.Navigate(expensePage);
            flyout.ShowAt(objectToShowAt);
        }
 private void TryShowFlyout(Flyout flyout, FrameworkElement location, FlyoutPlacementMode placementMode = FlyoutPlacementMode.Full)
 {
     try
     {
         flyout.Placement = placementMode;
         flyout.ShowAt(location);
     }
     catch (ArgumentException ex)
     {
         Debug.WriteLine("Error displaying flyout");
         LoggingService.Log(ex, LoggingLevel.Critical);
     }
 }
Exemple #7
0
        public void ShowFlyout(FrameworkElement element, FlyoutPlacementMode placement)
        {
            if (element.ActualWidth < rootGrid.MaxWidth)
            {
                rootGrid.Width = element.ActualWidth;
            }
            else
            {
                rootGrid.Width = rootGrid.MaxWidth;
            }

            rootGrid.MaxHeight = CoreWindow.GetForCurrentThread().Bounds.Height / 2;

            flyout.Placement = placement;
            flyout.ShowAt(element);
            placeToShow = element;
        }
Exemple #8
0
        public async Task Check_Placement_All_MenuFlyout(
            FlyoutPlacementMode placementMode,
            HorizontalPosition horizontalPosition,
            VerticalPosition verticalPosition)
        {
            var flyout = CreateBasicMenuFlyout();

            flyout.Placement = placementMode;

            const double MarginValue = 97;
            const int    TargetWidth = 88;
            var          target      = new Border
            {
                Margin = new Thickness(MarginValue),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Width      = TargetWidth,
                Height     = 23,
                Background = new SolidColorBrush(Colors.Red)
            };

            TestServices.WindowHelper.WindowContent = target;

            await TestServices.WindowHelper.WaitForLoaded(target);

            await TestServices.WindowHelper.WaitFor(() => target.ActualWidth == TargetWidth);             // For some reason target is initially stretched on iOS

            try
            {
                FlyoutBase.SetAttachedFlyout(target, flyout);
                FlyoutBase.ShowAttachedFlyout(target);

                var presenter = flyout.Presenter;

                await TestServices.WindowHelper.WaitForLoaded(presenter);

                var content = presenter.FindFirstChild <ScrollViewer>();

                VerifyRelativeContentPosition(horizontalPosition, verticalPosition, content, MarginValue, target);
            }
            finally
            {
                flyout.Hide();
            }
        }
Exemple #9
0
        public async Task Check_Placement_All_WithPosition(
            FlyoutPlacementMode placementMode,
            HorizontalPosition horizontalPosition,
            VerticalPosition verticalPosition)
        {
            var(flyout, content) = CreateFlyout();
            var position = new Windows.Foundation.Point(50, 50);
            var options  = new FlyoutShowOptions
            {
                Placement = placementMode,
                Position  = position,
            };

            const double MarginValue = 97;
            const int    TargetWidth = 88;
            var          target      = new Border
            {
                Margin = new Thickness(MarginValue),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Width      = TargetWidth,
                Height     = 23,
                Background = new SolidColorBrush(Colors.Red)
            };

            TestServices.WindowHelper.WindowContent = target;

            await TestServices.WindowHelper.WaitForLoaded(target);

            await TestServices.WindowHelper.WaitFor(() => target.ActualWidth == TargetWidth);             // For some reason target is initially stretched on iOS

            try
            {
                flyout.ShowAt(target, options);

                await TestServices.WindowHelper.WaitForLoaded(content);

                VerifyRelativeContentPosition(position, horizontalPosition, verticalPosition, content, MarginValue, target);
            }
            finally
            {
                flyout.Hide();
            }
        }
Exemple #10
0
        private void ShowMessage(string message, double duration)
        {
            FlyoutPlacementMode position = FlyoutPlacementMode.Bottom;

            var label = new TextBlock
            {
                Text                = message,
                Foreground          = new SolidColorBrush(Windows.UI.Colors.White),
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
            };
            var style = new Windows.UI.Xaml.Style {
                TargetType = typeof(FlyoutPresenter)
            };

            style.Setters.Add(new Windows.UI.Xaml.Setter(Control.BackgroundProperty, new SolidColorBrush(Windows.UI.Colors.Gray)));
            style.Setters.Add(new Windows.UI.Xaml.Setter(FrameworkElement.MaxHeightProperty, 1));
            var flyout = new Flyout
            {
                Content = label,
                AllowFocusOnInteraction = false,
                Placement            = position,
                FlyoutPresenterStyle = style,
            };

            flyout.OverlayInputPassThroughElement = Window.Current.Content;
            FrameworkElement mainElement = Window.Current.Content as FrameworkElement;

            flyout.ShowAt(mainElement);

            var timer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(duration)
            };

            timer.Tick += (sender, e) => {
                timer.Stop();
                flyout.Hide();
            };
            timer.Start();
        }
Exemple #11
0
        /// <summary>
        /// Gets flyout-postion Y on canvas.
        /// </summary>
        private double GetFlyoutPostionY(double buttonPostionY, double buttonHeight, FlyoutPlacementMode placementMode)
        {
            double layoutHeight = this.ActualHeight;

            if (layoutHeight < 50)
            {
                layoutHeight = 50;
            }

            switch (placementMode)
            {
            case FlyoutPlacementMode.Top:
                return(buttonPostionY - layoutHeight);

            case FlyoutPlacementMode.Bottom:
                return(buttonHeight);

            case FlyoutPlacementMode.Left:
            case FlyoutPlacementMode.Right:
                return(buttonPostionY + buttonHeight / 2 - layoutHeight / 2);

            default: return(0);
            }
        }
Exemple #12
0
        /// <summary>
        /// Gets flyout-postion X on canvas.
        /// </summary>
        private double GetFlyoutPostionX(double buttonPostionX, double buttonWidth, FlyoutPlacementMode placementMode)
        {
            double layoutWidth = this.ActualWidth;

            if (layoutWidth < 222)
            {
                layoutWidth = 222;
            }

            switch (placementMode)
            {
            case FlyoutPlacementMode.Top:
            case FlyoutPlacementMode.Bottom:
                return(buttonPostionX + buttonWidth / 2 - layoutWidth / 2);

            case FlyoutPlacementMode.Left:
                return(buttonPostionX - layoutWidth);

            case FlyoutPlacementMode.Right:
                return(buttonPostionX + buttonWidth);

            default: return(0);
            }
        }
Exemple #13
0
 public void ShowFlyout(FrameworkElement element, FlyoutPlacementMode place)
 {
     deckChooserFlyout.Placement = place;
     deckChooserFlyout.ShowAt(element);
     placeToShow = element;
 }
 public void ShowFlyout(FrameworkElement element, FlyoutPlacementMode placement)
 {
     flyout.Placement = placement;
     flyout.ShowAt(element);
     placeToShow = element;
 }
 public void ShowDotoFlyout(FrameworkElement frameworkElement, FlyoutPlacementMode flyoutPlacement, 
     string contentTemplate = "", UserControl flyoutControl = null)
 {
     Flyout flyout = new Flyout();
     if (flyoutControl != null)
     {
         flyout.Content = flyoutControl;
     }
     else
     {
         flyout.Content = new ContentPresenter
         {
             Content = viewModel,
             ContentTemplate = (DataTemplate)App.Current.Resources[contentTemplate]
         };
     }
     
     flyout.Placement = flyoutPlacement;
     if (frameworkElement is Button)
     {
         ((Button)frameworkElement).Flyout = flyout;
     }
     flyout.ShowAt(frameworkElement);
 }
Exemple #16
0
 public void ShowFlyout(FrameworkElement element, FlyoutPlacementMode place)
 {
     mediaInsertFlyout.Placement = place;
     mediaInsertFlyout.ShowAt(element);
     placeToShow = element;
 }
 public void ShowFlyout(FrameworkElement target, FlyoutPlacementMode placement)
 {
     colorPick.Placement = placement;
     colorPick.ShowAt(target);
 }