Beispiel #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);
            }
        }
Beispiel #2
0
 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);
     }
 }