Пример #1
0
        private static void callback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Window window = d as Window;

            if (window != null)
            {
                if ((bool)e.NewValue)
                {
                    StylizedBehaviors.SetBehaviors(window, new StylizedBehaviorCollection
                    {
                        new WindowsSettingBehaviour()
                    });
                }
                else
                {
                    StylizedBehaviors.SetBehaviors(window, null);
                }
            }
        }
Пример #2
0
        private static void callback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Window window = d as Window;

            if (window == null)
            {
                throw new Exception("SaveWindowPosition附加属性只能应用在Window类型上。");
            }

            if ((bool)e.NewValue)
            {
                StylizedBehaviors.SetBehaviors(window, new StylizedBehaviorCollection
                {
                    new WindowsSettingBehaviour()
                });
            }
            else
            {
                StylizedBehaviors.SetBehaviors(window, null);
            }
        }
Пример #3
0
        /// <inheritdoc />
        public ModernWindow()
        {
            BorderBrush = new SolidColorBrush(Color.FromRgb(0x00, 0x7a, 0xcc));
            // Enforce the visibility of the title bar and status bar.
            MinHeight = 35 + (ShowStatusBar ? 23 : 0) + 2;
            // Enforce the visibility of the icon (if any) and the window command buttons.
            MinWidth = 148;

            StylizedBehaviors.SetBehaviors(this, new StylizedBehaviorCollection
            {
                new BorderlessWindowBehavior(),
                new GlowWindowBehavior()
            });

            BindingOperations.SetBinding(this, GlowBrushProperty, new Binding
            {
                Source = this,
                Path   = new PropertyPath("BorderBrush")
            });
            SetCurrentValue(BorderThicknessProperty, new Thickness(0));
        }