Esempio n. 1
0
        private void ShowFlyoutAt(FlyoutBase flyout, FrameworkElement targetElement, FlyoutShowMode showMode = FlyoutShowMode.Transient)
        {
            bool useSecondaryCommandDynamicLabel      = (bool)UseSecondaryCommandDynamicLabelCheckBox.IsChecked;
            bool useSecondaryCommandDynamicVisibility = (bool)UseSecondaryCommandDynamicVisibilityCheckBox.IsChecked;
            bool clearSecondaryCommands = (bool)ClearSecondaryCommandsCheckBox.IsChecked;
            bool addPrimaryCommandDynamicallyCheckBox = (bool)AddPrimaryCommandDynamicallyCheckBox.IsChecked;
            bool clearPrimaryCommands = (bool)ClearPrimaryCommandsCheckBox.IsChecked;

            if (useSecondaryCommandDynamicLabel || useSecondaryCommandDynamicVisibility || addPrimaryCommandDynamicallyCheckBox || clearSecondaryCommands || clearPrimaryCommands)
            {
                CommandBarFlyout commandBarFlyout = flyout as CommandBarFlyout;

                if (commandBarFlyout != null)
                {
                    if (commandBarFlyout.SecondaryCommands != null && commandBarFlyout.SecondaryCommands.Count > 0)
                    {
                        if (useSecondaryCommandDynamicLabel)
                        {
                            SetDynamicLabelSecondaryCommand(commandBarFlyout.SecondaryCommands[0] as AppBarButton);
                        }

                        if (useSecondaryCommandDynamicVisibility && commandBarFlyout.SecondaryCommands.Count > 4)
                        {
                            SetDynamicVisibilitySecondaryCommand(commandBarFlyout.SecondaryCommands[4] as AppBarButton);
                        }

                        if (clearSecondaryCommands)
                        {
                            SetClearSecondaryCommandsFlyout(commandBarFlyout);
                        }
                    }

                    if (addPrimaryCommandDynamicallyCheckBox)
                    {
                        dynamicCommandBarFlyout = commandBarFlyout;
                        SetDynamicPrimaryCommand();
                    }

                    if (clearPrimaryCommands && commandBarFlyout.PrimaryCommands != null && commandBarFlyout.PrimaryCommands.Count > 0)
                    {
                        SetClearPrimaryCommandsFlyout(commandBarFlyout);
                    }
                }
            }

            if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
            {
                flyout.ShowAt(targetElement, new FlyoutShowOptions {
                    Placement = FlyoutPlacementMode.TopEdgeAlignedLeft, ShowMode = showMode
                });
            }
            else
            {
                flyout.Placement = FlyoutPlacementMode.Top;
                flyout.ShowAt(targetElement);
            }
        }
 private void ShowFlyoutAt(FlyoutBase flyout, FrameworkElement targetElement, FlyoutShowMode showMode = FlyoutShowMode.Transient)
 {
     if (PlatformConfiguration.IsOsVersionGreaterThanOrEqual(OSVersion.Redstone5))
     {
         flyout.ShowAt(targetElement, new FlyoutShowOptions {
             Placement = FlyoutPlacementMode.TopEdgeAlignedLeft, ShowMode = showMode
         });
     }
     else
     {
         flyout.Placement = FlyoutPlacementMode.Top;
         flyout.ShowAt(targetElement);
     }
 }
        private void ListViewItem_OnTapped(object sender, TappedRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
        private void OnPatientGridViewItemRightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            FrameworkElement el     = sender as FrameworkElement;
            FlyoutBase       flyout = FlyoutBase.GetAttachedFlyout(el);

            flyout.ShowAt(el);
        }
Esempio n. 5
0
        private void UIElement_OnHolding(object sender, DoubleTappedRoutedEventArgs doubleTappedRoutedEventArgs)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
Esempio n. 6
0
        private void RelativePanel_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
Esempio n. 7
0
        public object Execute(object sender, object parameter)
        {
            var eventArgs = parameter as HoldingRoutedEventArgs;

            if (eventArgs == null)
            {
                return(null);
            }

            var element = eventArgs.OriginalSource as FrameworkElement;

            if (element == null)
            {
                return(null);
            }

            if (!element.BaseUri.LocalPath.Contains("MovementDetailsPage.xaml")) // Don't display de flyout if holding comes from movement details page
            {
                FrameworkElement senderElement = sender as FrameworkElement;
                FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);
                flyoutBase.ShowAt(senderElement);

                HoldedObject = element.DataContext;
            }

            return(null);
        }
Esempio n. 8
0
        private void Grid_Holding(object sender, HoldingRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
        public object Execute(object sender, object parameter)
        {
            if (!ShallDisplay)
            {
                return(null);
            }

            FrameworkElement senderElement = sender as FrameworkElement;

            if (senderElement.Tag != null)
            {
                var type = senderElement.Tag.GetType();
                foreach (var prop in type.GetProperties())
                {
                    var attr = prop.GetCustomAttribute <MenuFlyoutIndicatorAttribute>(true);
                    if (attr != null && prop.PropertyType == typeof(bool))
                    {
                        bool noskip = (bool)prop.GetValue(senderElement.Tag);
                        if (!noskip)
                        {
                            return(null);
                        }
                    }
                }
            }

            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);

            return(null);
        }
Esempio n. 10
0
        private void StackPanel_Holding(object sender, HoldingRoutedEventArgs e)
        {
            StackPanel panel      = sender as StackPanel;
            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(panel);

            flyoutBase.ShowAt(panel);
        }
Esempio n. 11
0
        public void RecipeGroup_RightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
Esempio n. 12
0
        private void ImageItem_OnClick(object sender, ItemClickEventArgs e)
        {
            var attachment = e.ClickedItem as Attachment;

            if (attachment == null)
            {
                return;
            }

            var grid = sender as AdaptiveGridView;

            if (grid == null)
            {
                return;
            }

            var status = grid.DataContext as Status;

            if (status == null)
            {
                return;
            }
            ImageGalleryView.ViewModel.SetStatus(status, attachment);
            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(StatusGrid);

            flyoutBase.ShowAt(StatusGrid);
        }
Esempio n. 13
0
        /// <summary>
        /// Gets the <c>Shop</c>-Object of the holded List-Item in the
        /// Shops-<c>ListView</c> and sets this <c>Shop</c>-Object as the <c>SelectedShop</c>-Object in the <c>MainPageViewModel</c>.
        /// </summary>
        /// <param name="sender">The Sender of the <c>Holding</c>-Event (a List-Item in the <c>ListView</c>)</param>
        /// <param name="parameter">The parameters that the sender sends to the <c>Execute</c>-Method (specified by the caller)</param>
        /// <returns><c>null</c></returns>
        public object Execute(object sender, object parameter)
        {
            // Get sender of the Action
            FrameworkElement senderElement = sender as FrameworkElement;

            if (senderElement.DataContext.GetType() == typeof(Shop))
            {
                // Set the in the ListView currently selected Shop in the MainViewModel
                ServiceLocator.Current.GetInstance <MainPageViewModel>().SelectedShop = (Shop)senderElement.DataContext;
            }
            else if (senderElement.DataContext.GetType() == typeof(ShoppingList))
            {
                // Set the in the ListView currently selected ShoppingList in the MainViewModel
                ServiceLocator.Current.GetInstance <MainPageViewModel>().SelectedShoppingList = (ShoppingList)senderElement.DataContext;
            }
            else if (senderElement.DataContext.GetType() == typeof(ShoppingListItem))
            {
                ServiceLocator.Current.GetInstance <AddShoppingListItemViewModel>().ShoppingListItem = (ShoppingListItem)senderElement.DataContext;
            }

            // Show the MenuFlyout
            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);

            return(null);
        }
Esempio n. 14
0
    private void ShowFlyout(object obj)
    {
        FrameworkElement senderElement = obj as FrameworkElement;
        FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

        flyoutBase.ShowAt(senderElement);
    }
        private void Grid_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
Esempio n. 16
0
        /// <summary>
        /// Вызывает отображение контекстного меню.
        /// </summary>
        /// <param name="sender">Объект, с которым связано меню.</param>
        private void ShowFlyout(FrameworkElement sender)
        {
            Select(sender);
            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(sender);

            flyoutBase.ShowAt(sender);
        }
Esempio n. 17
0
        public static void ShowAtEx([NotNull] this FlyoutBase flyoutBase, [NotNull] FrameworkElement placementTarget)
        {
            Should.NotBeNull(flyoutBase, nameof(flyoutBase));
            Should.NotBeNull(placementTarget, nameof(placementTarget));
            var flyout = flyoutBase as Flyout;

            if (flyout == null)
            {
                var items = (flyoutBase as MenuFlyout)?.Items;
                if (items != null)
                {
                    foreach (MenuFlyoutItemBase item in items)
                    {
                        ParentObserver.Set(item, placementTarget);
                    }
                }
            }
            else
            {
                var content = flyout.Content as FrameworkElement;
                if (content != null)
                {
                    ParentObserver.Set(content, placementTarget);
                }
            }
            flyoutBase.ShowAt(placementTarget);
        }
        /// <summary>
        ///     Shows the flyout placed in relation to the specified element, and use this element as parent for content items.
        /// </summary>
        /// <param name="flyoutBase">The specified flayout.</param>
        /// <param name="placementTarget">The element to use as the flyout's placement target.</param>
        public static void ShowAtEx([NotNull] this FlyoutBase flyoutBase, [NotNull] FrameworkElement placementTarget)
        {
            Should.NotBeNull(flyoutBase, "flyoutBase");
            Should.NotBeNull(placementTarget, "placementTarget");
            var flyout = flyoutBase as Flyout;

            if (flyout == null)
            {
                var menuFlyout = flyoutBase as MenuFlyout;
                if (menuFlyout != null && menuFlyout.Items != null)
                {
                    foreach (MenuFlyoutItemBase item in menuFlyout.Items)
                    {
                        ParentObserver.GetOrAdd(item).Parent = placementTarget;
                    }
                }
            }
            else
            {
                var content = flyout.Content as FrameworkElement;
                if (content != null)
                {
                    ParentObserver.GetOrAdd(content).Parent = placementTarget;
                }
            }
            flyoutBase.ShowAt(placementTarget);
        }
Esempio n. 19
0
        private void Grid_RightTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
Esempio n. 20
0
        private void context_menu(object sender, RightTappedRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
Esempio n. 21
0
        public static void ShowFlyoutBase(object sender)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
        private void AttemptStartDeferredOperation()
        {
            AssertInvariants();

            if (m_flyoutState == FlyoutState.Closed)
            {
                //wrl::ComPtr<wf::IAsyncInfo> spAsyncInfo;
                //wf::AsyncStatus asyncStatus = wf::AsyncStatus::Started;

                //IFC(m_spCurrentOperation.As(&spAsyncInfo));
                //IFC(spAsyncInfo->get_Status(&asyncStatus));
                var asyncStatus = m_spCurrentOperation.Status;

                if (asyncStatus == AsyncStatus.Canceled)
                {
                    Complete(m_cancellationValueCallback());
                }
                else
                {
                    //NT_ASSERT(asyncStatus == wf::AsyncStatus::Started);
                    Debug.Assert(asyncStatus == AsyncStatus.Started);
                    m_pAssociatedFlyoutNoRef.ShowAt(m_tpTargetForDeferredShowAt);
                    m_isShowAtForCurrentOperationDeferred = false;
                    m_tpTargetForDeferredShowAt           = null;
                }
            }
            // else something else reopened the flyout before this callback had a
            // chance to run, possibly with a different placement target. In this case
            // just keep the deferred operation active and wait again for the
            // current flyout to close.

            AssertInvariants();
        }
Esempio n. 23
0
        private void OnPrescriptionGridRightTapped(object sender, RightTappedRoutedEventArgs e)
        {
            FrameworkElement el     = sender as FrameworkElement;
            FlyoutBase       flyout = FlyoutBase.GetAttachedFlyout(el);

            flyout.ShowAt(el);
        }
Esempio n. 24
0
        private static void OnTapped(object sender, TappedRoutedEventArgs e)
        {
            try
            {
                FrameworkElement frameworkElement = (FrameworkElement)sender;
                FlyoutBase       flyoutBase       = FlyoutBase.GetAttachedFlyout(frameworkElement);
                if (flyoutBase != null)
                {
                    Flyout flyout = flyoutBase as Flyout;
                    if (flyout != null)
                    {
                        flyout.Placement = ResponsiveHelper.GetPopupPlacement();
                        if (flyout.Content is IFlyoutContent)
                        {
                            ((IFlyoutContent)flyout.Content).HandleFlyout(flyout);
                        }
                    }

                    flyoutBase.ShowAt(frameworkElement);
                }
            }
            catch (Exception ex)
            {
                var messageBoxService = Ioc.Resolve <IMessageBoxService>();
                messageBoxService.ShowAsync(
                    StringResources.Message_Information,
                    "It looks like 2Day is having trouble here - that seems due to the latest Windows 10 Mobile insiders build. You can change due date by sliding left a task in the task list for now :-)");

                TrackingManagerHelper.Exception(ex, "OpenFlyoutOnTap.OnTapped");
                throw;
            }
        }
Esempio n. 25
0
        private void OnTapped(object sender, TappedRoutedEventArgs e)
        {
            FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(this);

            if (flyoutBase != null)
            {
                Flyout flyout = flyoutBase as Flyout;
                if (flyout != null)
                {
                    if (this.IsFullWidthFlyoutEnabled)
                    {
                        flyout.Placement = ResponsiveHelper.GetPopupPlacement();
                    }
                    else
                    {
                        flyout.Placement = FlyoutPlacementMode.Bottom;
                    }

                    if (flyout.Content is IFlyoutContent)
                    {
                        ((IFlyoutContent)flyout.Content).HandleFlyout(flyout);
                    }
                }

                flyoutBase.ShowAt(this);
            }
        }
Esempio n. 26
0
 private void NavView_OnItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
 {
     if (args.InvokedItemContainer == openStatisticMenu)
     {
         FlyoutBase flyout = FlyoutBase.GetAttachedFlyout(openStatisticMenu);
         flyout.ShowAt(openStatisticMenu);
     }
 }
Esempio n. 27
0
 /// <summary>
 /// Empties the result message.
 /// </summary>
 public void emptyResultMessage()
 {
     if (Model.Receipes.Count == 0)
     {
         FlyoutBase fly = FlyoutBase.GetAttachedFlyout(this.resultsSection);
         fly.ShowAt(this.resultsSection);
     }
 }
        private void OpenContextMenu(object sender, HoldingRoutedEventArgs e)
        {
            AddTransactionView.IsNavigationBlocked = true;
            var        senderElement = sender as FrameworkElement;
            FlyoutBase flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.ShowAt(senderElement);
        }
Esempio n. 29
0
 private void RadioButton_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
 {
     FrameworkElement senderElement = sender as FrameworkElement;
     // If you need the clicked element:
     // Item whichOne = senderElement.DataContext as Item;
     FlyoutBase flyoutBase = FlyoutBase.GetAttachedFlyout(senderElement);
     flyoutBase.ShowAt(senderElement);
 }
Esempio n. 30
0
        /// <summary>
        /// Tap event that shows our custom bindable fly out.
        /// </summary>
        private void ShowLinePickerFlyout(object sender, TappedRoutedEventArgs e)
        {
            FrameworkElement senderElement = sender as FrameworkElement;
            FlyoutBase       flyoutBase    = FlyoutBase.GetAttachedFlyout(senderElement);

            flyoutBase.Placement = FlyoutPlacementMode.Bottom;
            flyoutBase.ShowAt(senderElement);
        }
Esempio n. 31
0
 private void libraryItemRenderer_RightTapped(object sender, RightTappedRoutedEventArgs e)
 {
     _flyout = FlyoutBase.GetAttachedFlyout((sender as FrameworkElement));
     _flyout.Placement = FlyoutPlacementMode.Right;
     _flyout.ShowAt((sender as FrameworkElement));
 }