当前位置: 首页>>代码示例>>C#>>正文


C# Controls.Flyout类代码示例

本文整理汇总了C#中MahApps.Metro.Controls.Flyout的典型用法代码示例。如果您正苦于以下问题:C# Flyout类的具体用法?C# Flyout怎么用?C# Flyout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Flyout类属于MahApps.Metro.Controls命名空间,在下文中一共展示了Flyout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DetectTheme

        private static Tuple<Theme, Accent> DetectTheme(Flyout flyout)
        {
            if (flyout == null)
                return null;

            // first look for owner
            var window = flyout.TryFindParent<MetroWindow>();
            var theme = window != null ? ThemeManager.DetectTheme(window) : null;
            if (theme != null && theme.Item2 != null)
                return theme;

            // second try, look for main window
            if (Application.Current != null) {
                var mainWindow = Application.Current.MainWindow as MetroWindow;
                theme = mainWindow != null ? ThemeManager.DetectTheme(mainWindow) : null;
                if (theme != null && theme.Item2 != null)
                    return theme;

                // oh no, now look at application resource
                theme = ThemeManager.DetectTheme(Application.Current);
                if (theme != null && theme.Item2 != null)
                    return theme;
            }
            return null;
        }
开发者ID:stefan-schweiger,项目名称:MahApps.Metro,代码行数:25,代码来源:Flyout.cs

示例2: DetachHandlers

 private void DetachHandlers(Flyout item)
 {
     var isOpenChanged = DependencyPropertyDescriptor.FromProperty(Flyout.IsOpenProperty, typeof(Flyout));
     var themeChanged = DependencyPropertyDescriptor.FromProperty(Flyout.ThemeProperty, typeof(Flyout));
     isOpenChanged.RemoveValueChanged(item, this.FlyoutStatusChanged);
     themeChanged.RemoveValueChanged(item, this.FlyoutStatusChanged);
 }
开发者ID:holymoo,项目名称:MahApps.Metro,代码行数:7,代码来源:FlyoutsControl.cs

示例3: InitWindow

        /// <summary>
        /// Initializes the control with a <see cref="MainWindow"/>. Necessary, as the <see cref="Window.GetWindow"/> method is unable to find a window for flyout controls.
        /// </summary>
        /// <param name="mainWindow">The <see cref="MainWindow"/>.</param>
        public void InitWindow( MainWindow mainWindow )
        {
            this.window = mainWindow;
            flyout = window.OSFlyout;
            flyout.IsOpenChanged += OsFlyoutOnIsOpenChanged;

            downloader = new WebClient( );
            downloader.DownloadProgressChanged += ( Sender, Args ) => controller.SetProgress( Args.BytesReceived );;
            downloader.DownloadFileCompleted += DownloaderOnDownloadFileCompleted;

            LanguageList.SelectionChanged += ( Sender, Args ) =>
            {
                bool HasSelection = LanguageList.SelectedItems.Count > 0;

                DownloadSubsLanguagesButton.IsEnabled = HasSelection;
            };

            window.SizeChanged += ( Sender, Args ) =>
            {
                if ( !Args.WidthChanged )
                    return;

                this.Width = Args.NewSize.Width * 0.8;
            };
        }
开发者ID:Wolf-Code,项目名称:Videre,代码行数:29,代码来源:OpenSubtitlesControl.xaml.cs

示例4: FlyoutInfo

        public FlyoutInfo(Flyout flyout, object content)
        {
            Argument.IsNotNull(() => flyout);
            Argument.IsNotNull(() => content);

            Flyout = flyout;
            Content = content;
        }
开发者ID:WildGums,项目名称:Orchestra,代码行数:8,代码来源:FlyoutInfo.cs

示例5: AboutActions

 public AboutActions()
 {
     InitializeComponent();
     Loaded += (sender, args) =>
         {
             NotifyOnInternalButtonClick();
             parent = this.GetParentObject() as Flyout;
         };
 }
开发者ID:AndreyPetrov1991,项目名称:SP,代码行数:9,代码来源:AboutActions.xaml.cs

示例6: switch

 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.TaskSetup = ((MahApps.Metro.Controls.Flyout)(target));
     return;
     }
     this._contentLoaded = true;
 }
开发者ID:killnine,项目名称:FlyoutTest,代码行数:9,代码来源:MainWindow.g.cs

示例7: HideFlyout

        public void HideFlyout(Flyout flyout)
        {
            var actualType = flyout.GetType();
            var openFlyoutDetail = openFlyouts.FirstOrDefault(x => x.FlyoutType == actualType);
            if (openFlyoutDetail != null)
                openFlyoutDetail.IsHidden = true;

            flyout.IsOpen = false;
        }
开发者ID:BlythMeister,项目名称:Gallifrey,代码行数:9,代码来源:ModelHelpers.cs

示例8: AddFlyout

        public void AddFlyout(string name, Type viewType, Position position, UnloadBehavior unloadBehavior = UnloadBehavior.SaveAndCloseViewModel)
        {
            Argument.IsNotNullOrWhitespace(() => name);
            Argument.IsNotNull(() => viewType);

            Log.Info("Adding flyout '{0}' with view type '{1}'", name, viewType.FullName);

            var content = (UIElement) _typeFactory.CreateInstance(viewType);

            var flyout = new Flyout();
            flyout.Theme = FlyoutTheme.Adapt;
            flyout.Position = position;

            var flyoutInfo = new FlyoutInfo(flyout, content);

            flyout.SetBinding(Flyout.HeaderProperty, new Binding("ViewModel.Title") {Source = content});

            ((ICompositeCommand) _commandManager.GetCommand("Close")).RegisterAction(() => { flyout.IsOpen = false; });

            flyout.IsOpenChanged += async (sender, e) =>
            {
                if (!flyout.IsOpen)
                {
                    var vmContainer = flyout.Content as IViewModelContainer;
                    if (vmContainer != null)
                    {
                        var vm = vmContainer.ViewModel;
                        if (vm != null)
                        {
                            switch (unloadBehavior)
                            {
                                case UnloadBehavior.CloseViewModel:
                                    await vm.CloseViewModelAsync(null);
                                    break;

                                case UnloadBehavior.SaveAndCloseViewModel:
                                    await vm.SaveAndCloseViewModelAsync();
                                    break;

                                case UnloadBehavior.CancelAndCloseViewModel:
                                    await vm.CancelAndCloseViewModelAsync();
                                    break;

                                default:
                                    throw new ArgumentOutOfRangeException("unloadBehavior");
                            }
                        }
                    }

                    flyout.Content = null;
                    flyout.DataContext = null;
                }
            };

            _flyouts[name] = flyoutInfo;
        }
开发者ID:icygit,项目名称:Orchestra,代码行数:56,代码来源:FlyoutService.cs

示例9: AttachHandlers

        private void AttachHandlers(Flyout flyout)
        {
            var isOpenNotifier = new PropertyChangeNotifier(flyout, Flyout.IsOpenProperty);
            isOpenNotifier.ValueChanged += FlyoutStatusChanged;
            flyout.IsOpenPropertyChangeNotifier = isOpenNotifier;

            var themeNotifier = new PropertyChangeNotifier(flyout, Flyout.ThemeProperty);
            themeNotifier.ValueChanged += FlyoutStatusChanged;
            flyout.ThemePropertyChangeNotifier = themeNotifier;
        }
开发者ID:Acaspita,项目名称:MahApps.Metro,代码行数:10,代码来源:FlyoutsControl.cs

示例10: UnregisterFlyout

        public void UnregisterFlyout(Flyout flyout)
        {
            var mainWindow = Application.Current.MainWindow as MetroWindow;

            if (mainWindow != null)
            {
                flyout.Loaded -= IsOpenBeforeLoadedWorkaround;

                mainWindow.Flyouts.Remove(flyout);
            }
        }
开发者ID:torshy,项目名称:FileReplicator,代码行数:11,代码来源:FlyoutService.cs

示例11: HandleFlyoutStatusChange

        internal void HandleFlyoutStatusChange(Flyout flyout, MetroWindow parentWindow)
        {
            if (flyout == null || parentWindow == null)
            {
                return;
            }

            this.ReorderZIndices(flyout);

            var visibleFlyouts = this.GetFlyouts(this.Items).Where(i => i.IsOpen).OrderBy(Panel.GetZIndex);
            parentWindow.HandleFlyoutStatusChange(flyout, visibleFlyouts);
        }
开发者ID:Acaspita,项目名称:MahApps.Metro,代码行数:12,代码来源:FlyoutsControl.cs

示例12: CloseFlyout

        public void CloseFlyout(Flyout flyout)
        {
            var actualType = flyout.GetType();
            var openFlyoutDetail = openFlyouts.FirstOrDefault(x => x.FlyoutType == actualType);
            if (openFlyoutDetail != null)
            {
                openFlyoutDetail.IsHidden = false;
            }

            flyout.IsOpen = false;
            FlyoutClosedHandler(flyout, null);
        }
开发者ID:BlythMeister,项目名称:Gallifrey,代码行数:12,代码来源:ModelHelpers.cs

示例13: MainWindow_Loaded

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            _dataContext.ShowDefaultCharts();
            Flyouts = new FlyoutsControl();
            Flyout control = new Flyout();
            _lineEditorView = new ucLineEditorView(Token);
            _lineEditorView.DataContext = new LineEditorViewModel(Token);
            GlobalDataModel.LineEditorViewModel = _lineEditorView.DataContext as LineEditorViewModel;
            control.Content = _lineEditorView;

            control.Position = Position.Right;
            control.Width = 195;
            control.IsOpenChanged += control_IsOpenChanged;
            Flyouts.Items.Add(control);
        }
开发者ID:nearcoding,项目名称:GAP,代码行数:15,代码来源:MainWindow.xaml.cs

示例14: AdaptsWindowCommandsToDarkFlyout

        public async Task AdaptsWindowCommandsToDarkFlyout()
        {
            await TestHost.SwitchToAppThread();

            var window = await WindowHelpers.CreateInvisibleWindowAsync<FlyoutWindow>();

            var flyout = new Flyout { Theme = FlyoutTheme.Dark };
            window.Flyouts.Items.Add(flyout);

            flyout.IsOpen = true;

            Color expectedColor = ((SolidColorBrush)ThemeManager.GetAppTheme("BaseDark").Resources["BlackBrush"]).Color;

            window.AssertWindowCommandsColor(expectedColor);
        }
开发者ID:Amrykid,项目名称:MahApps.Metro,代码行数:15,代码来源:FlyoutTest.cs

示例15: SetSettingsFlyoutControl

        public void SetSettingsFlyoutControl()
        {
            var window = Hearthstone_Deck_Tracker.API.Core.MainWindow;
            var flyouts = window.Flyouts.Items;

            Flyout flyout = new Flyout();
            flyout.Name = "PluginSettingsFlyoutControl";
            flyout.Header = "Video Game Recorder";
            flyout.Content = new SettingsControl();
            flyout.Position = Position.Left;
            Panel.SetZIndex(flyout, 100);

            flyouts.Add(flyout);

            _settingsFlyout = flyout;
        }
开发者ID:becelot,项目名称:HDT_VideoRecorder,代码行数:16,代码来源:PluginContainer.cs


注:本文中的MahApps.Metro.Controls.Flyout类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。