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


C# MetroWindow.SetValue方法代码示例

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


在下文中一共展示了MetroWindow.SetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnsureWindow

        protected override Window EnsureWindow(object model, object view, bool isDialog) {
            var window = view as Window;

            if (window == null) {
                var metroWindow = new MetroWindow {
                    Content = view,
                    SizeToContent = SizeToContent.WidthAndHeight,
                    TitlebarHeight = 0
                };
                window = metroWindow;
                //Interaction.GetBehaviors(metroWindow).Add(new GlowWindowBehavior());
                metroWindow.SetValue(MoveableWindowBehavior.IsEnabledProperty, true);
                metroWindow.SetValue(View.IsGeneratedProperty, true);

                var owner = InferOwnerOf(window);
                if (owner != null) {
                    window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    window.Owner = owner;
                } else
                    window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            } else {
                var owner = InferOwnerOf(window);
                if ((owner != null) && isDialog)
                    window.Owner = owner;
            }

            SetupRxWindow(model, view, window);

            return window;
        }
开发者ID:SIXNetworks,项目名称:withSIX.Desktop,代码行数:30,代码来源:CustomWindowManager.cs

示例2: EnsureWindow

        protected override Window EnsureWindow(object model, object view, bool isDialog)
        {
            var window = view as MetroWindow;
            if (window == null)
            {
                window = new MetroWindow { Content = view, };
                window.SetValue(View.IsGeneratedProperty, true);
                window.Resources.MergedDictionaries.Add(this.themeManager.GetThemeResources());

                var owner = this.InferOwnerOf(window);
                if (owner != null)
                {
                    window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    window.ShowInTaskbar = false;
                    window.Owner = owner;
                }
                else
                {
                    window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }
            }
            else
            {
                var owner2 = this.InferOwnerOf(window);
                if (owner2 != null && isDialog)
                {
                    window.ShowInTaskbar = false;
                    window.Owner = owner2;
                }
            }

            return window;
        }
开发者ID:gordonc64,项目名称:AO-Workbench,代码行数:33,代码来源:WindowManager.cs

示例3: EnsureWindow

        protected override Window EnsureWindow(object model, object view, bool isDialog)
        {
            var metroWindow = view as MetroWindow;
            if (metroWindow == null)
            {
                var userControl = view as UserControl;
                double minHeight = 150D;
                double minWidth = 500D;
                double? height = null;
                double? width = null;
                if (userControl != null)
                {
                    minHeight = userControl.MinHeight;
                    minWidth = userControl.MinWidth;
                    height = userControl.Height;
                    width = userControl.Width;
                }

                metroWindow = new MetroWindow
                {
                    Content = view,
                    SizeToContent = SizeToContent.Manual,
                    MinHeight = minHeight,
                    MinWidth = minWidth,
                    SaveWindowPosition = true
                };
                if (height.HasValue && width.HasValue)
                {
                    metroWindow.Height = height.Value;
                    metroWindow.Width = width.Value;
                }

                foreach (var resourceDict in _resources)
                {
                    metroWindow.Resources.MergedDictionaries.Add(resourceDict);
                }

                metroWindow.SetValue(View.IsGeneratedProperty, true);
                var owner = this.InferOwnerOf(metroWindow);
                if (owner != null)
                {
                    metroWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    metroWindow.Owner = owner;
                }
                else
                {
                    metroWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }
            }
            else
            {
                var owner = this.InferOwnerOf(metroWindow);
                if (owner != null && isDialog)
                    metroWindow.Owner = owner;
            }

            return metroWindow;
        }
开发者ID:ajryan,项目名称:InterTail,代码行数:58,代码来源:MahWindowManager.cs

示例4: CreateMetroWindow

        private MetroWindow CreateMetroWindow(object view)
        {
            var metroWindow = new MetroWindow
            {
                Content = view,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            metroWindow.SetValue(View.IsGeneratedProperty, true);

            AddMetroResources(metroWindow);

            var owner = InferOwnerOf(metroWindow);
            if (owner != null)
            {
                metroWindow.Owner = owner;
                metroWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            }

            return metroWindow;
        }
开发者ID:Wagnerp,项目名称:scriptcs-editor,代码行数:21,代码来源:MetroWindowManager.cs

示例5: EnsureWindow

        protected override Window EnsureWindow(object model, object view, bool isDialog)
        {
            if (!isDialog)
                return base.EnsureWindow(model, view, isDialog);

            var window = view as MetroWindow;

            if (window == null)
            {
                var userControl = view as UserControl;

                var appShell = IoC.Get<MainViewModel>() as IViewAware;

                //var scrollViewer = new ScrollViewer { Content = view };

                window = new MetroWindow
                {
                    //Content = scrollViewer,
                    Content = view,
                    SizeToContent = SizeToContent.WidthAndHeight,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner
                };

                if (userControl != null)
                {
                    window.MinHeight = userControl.MinHeight;
                    window.MinWidth = userControl.MinWidth;
                }

                //scrollViewer.SetValue(View.IsGeneratedProperty, true);
                window.SetValue(View.IsGeneratedProperty, true);
                window.Owner = appShell.GetView() as Window;
                window.ShowCloseButton = false;
                window.ShowMaxRestoreButton = false;
                window.ShowMinButton = false;
                window.GlowBrush = new SolidColorBrush(Colors.Gray);
            }

            return window;
        }
开发者ID:brianpelton,项目名称:PaperPusher,代码行数:40,代码来源:WindowManager.cs


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