Inheritance: System.Windows.Controls.ItemsControl
Esempio n. 1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (WindowCommands == null)
            {
                WindowCommands = new WindowCommands();
            }

            titleBar = GetTemplateChild(PART_TitleBar) as UIElement;

            if (titleBar != null && titleBar.Visibility == System.Windows.Visibility.Visible)
            {
                titleBar.MouseDown += TitleBarMouseDown;
                titleBar.MouseUp   += TitleBarMouseUp;
                titleBar.MouseMove += TitleBarMouseMove;
            }
            else
            {
                MouseDown += TitleBarMouseDown;
                MouseUp   += TitleBarMouseUp;
                MouseMove += TitleBarMouseMove;
            }

            WindowCommandsPresenter = GetTemplateChild("PART_WindowCommands") as ContentPresenter;
        }
Esempio n. 2
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (TextBlockStyle != null && !this.Resources.Contains(typeof(TextBlock)))
            {
                this.Resources.Add(typeof(TextBlock), TextBlockStyle);
            }

            if (WindowCommands == null)
            {
                WindowCommands = new WindowCommands();
            }
            WindowCommandsPresenter = GetTemplateChild("PART_WindowCommands") as ContentPresenter;
            WindowButtonCommands    = GetTemplateChild(PART_WindowButtonCommands) as WindowButtonCommands;

            overlayBox             = GetTemplateChild(PART_OverlayBox) as Grid;
            messageDialogContainer = GetTemplateChild(PART_MessageDialogContainer) as Grid;
            flyoutModal            = GetTemplateChild(PART_FlyoutModal) as Rectangle;

            titleBar = GetTemplateChild(PART_TitleBar) as UIElement;

            if (titleBar != null && titleBar.Visibility == System.Windows.Visibility.Visible)
            {
                titleBar.MouseDown += TitleBarMouseDown;
                titleBar.MouseUp   += TitleBarMouseUp;
                titleBar.MouseMove += TitleBarMouseMove;
            }
            else
            {
                MouseDown += TitleBarMouseDown;
                MouseUp   += TitleBarMouseUp;
                MouseMove += TitleBarMouseMove;
            }
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (LeftWindowCommands == null)
            {
                LeftWindowCommands = new WindowCommands();
            }
            if (RightWindowCommands == null)
            {
                RightWindowCommands = new WindowCommands();
            }

            LeftWindowCommandsPresenter  = GetTemplateChild(PART_LeftWindowCommands) as ContentPresenter;
            RightWindowCommandsPresenter = GetTemplateChild(PART_RightWindowCommands) as ContentPresenter;
            WindowButtonCommands         = GetTemplateChild(PART_WindowButtonCommands) as WindowButtonCommands;

            overlayBox                    = GetTemplateChild(PART_OverlayBox) as Grid;
            metroDialogContainer          = GetTemplateChild(PART_MetroDialogContainer) as Grid;
            flyoutModal                   = (Rectangle)GetTemplateChild(PART_FlyoutModal);
            flyoutModal.PreviewMouseDown += FlyoutsPreviewMouseDown;
            this.PreviewMouseDown        += FlyoutsPreviewMouseDown;

            icon               = GetTemplateChild(PART_Icon) as UIElement;
            titleBar           = GetTemplateChild(PART_TitleBar) as UIElement;
            titleBarBackground = GetTemplateChild(PART_WindowTitleBackground) as UIElement;

            this.SetVisibiltyForAllTitleElements(this.TitlebarHeight > 0);
        }
Esempio n. 4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (WindowCommands == null)
            {
                WindowCommands = new WindowCommands();
            }

            var titleBar = GetTemplateChild(PART_TitleBar) as UIElement;

            if (ShowTitleBar && titleBar != null)
            {
                titleBar.MouseDown += TitleBarMouseDown;
                titleBar.MouseUp   += TitleBarMouseUp;
                titleBar.MouseMove += TitleBarMouseMove;
            }
            else
            {
                MouseDown += TitleBarMouseDown;
                MouseUp   += TitleBarMouseUp;
                MouseMove += TitleBarMouseMove;
            }

            WindowCommandsPresenter = GetTemplateChild("PART_WindowCommands") as ContentPresenter;
        }
Esempio n. 5
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (WindowCommands == null)
            {
                WindowCommands = new WindowCommands();
            }

            WindowCommandsPresenter = GetTemplateChild("PART_WindowCommands") as ContentPresenter;
            WindowButtonCommands    = GetTemplateChild(PART_WindowButtonCommands) as WindowButtonCommands;

            overlayBox                    = GetTemplateChild(PART_OverlayBox) as Grid;
            metroDialogContainer          = GetTemplateChild(PART_MetroDialogContainer) as Grid;
            flyoutModal                   = GetTemplateChild(PART_FlyoutModal) as Rectangle;
            flyoutModal.PreviewMouseDown += FlyoutsPreviewMouseDown;
            this.PreviewMouseDown        += FlyoutsPreviewMouseDown;

            titleBar = GetTemplateChild(PART_TitleBar) as UIElement;

            if (titleBar != null && titleBar.Visibility == Visibility.Visible)
            {
                titleBar.MouseDown += TitleBarMouseDown;
                titleBar.MouseUp   += TitleBarMouseUp;
                titleBar.MouseMove += TitleBarMouseMove;
            }
            else
            {
                MouseDown += TitleBarMouseDown;
                MouseUp   += TitleBarMouseUp;
                MouseMove += TitleBarMouseMove;
            }
        }
Esempio n. 6
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.MetroWindow = ((StudentManagement.MainWindow)(target));
                return;

            case 2:
                this.AccountFlyout = ((MahApps.Metro.Controls.Flyout)(target));
                return;

            case 3:
                this.AccountSettingsFlyout = ((MahApps.Metro.Controls.Flyout)(target));
                return;

            case 4:
                this.Account = ((MahApps.Metro.Controls.WindowCommands)(target));
                return;

            case 5:
                this.cmbChangeUC = ((System.Windows.Controls.ComboBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 7
0
        protected override void OnStateChanged(EventArgs e)
        {
            if (WindowCommands != null)
            {
                WindowCommands.RefreshMaximiseIconState();
            }

            base.OnStateChanged(e);
        }
Esempio n. 8
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.flyoutsControlRegion = ((MahApps.Metro.Controls.FlyoutsControl)(target));
                return;

            case 2:
                this.rightWindowCommandsRegion = ((MahApps.Metro.Controls.WindowCommands)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 9
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            var titleBar = GetTemplateChild(PART_TitleBar) as UIElement;
            windowCommands = GetTemplateChild(PART_WindowCommands) as WindowCommands;

            if (titleBar != null)
            {
                titleBar.MouseDown += TitleBarMouseDown;
                titleBar.MouseMove += TitleBarMouseMove;
            }
            else
            {
                MouseDown += TitleBarMouseDown;
                MouseMove += TitleBarMouseMove;
            }
        }
Esempio n. 10
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 21 "..\..\MainWindow.xaml"
                ((SMSGatewayWpf.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.MetroWindow_Closing);

            #line default
            #line hidden
                return;

            case 2:
                this.commands = ((MahApps.Metro.Controls.WindowCommands)(target));
                return;

            case 3:
                this.btnSettings = ((System.Windows.Controls.Button)(target));

            #line 56 "..\..\MainWindow.xaml"
                this.btnSettings.Click += new System.Windows.RoutedEventHandler(this.btnSettings_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.btnAbout = ((System.Windows.Controls.Button)(target));

            #line 57 "..\..\MainWindow.xaml"
                this.btnAbout.Click += new System.Windows.RoutedEventHandler(this.btnAbout_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.transitionContentHome = ((MahApps.Metro.Controls.TransitioningContentControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 11
0
        private static void OnThemeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (e.NewValue == e.OldValue)
            {
                return;
            }
            WindowCommands windowCommand = (WindowCommands)d;

            if ((MahApps.Metro.Controls.Theme)e.NewValue == MahApps.Metro.Controls.Theme.Light)
            {
                if (windowCommand.LightTemplate != null)
                {
                    windowCommand.SetValue(Control.TemplateProperty, windowCommand.LightTemplate);
                    return;
                }
            }
            else if ((MahApps.Metro.Controls.Theme)e.NewValue == MahApps.Metro.Controls.Theme.Dark && windowCommand.DarkTemplate != null)
            {
                windowCommand.SetValue(Control.TemplateProperty, windowCommand.DarkTemplate);
            }
        }
Esempio n. 12
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     
     #line 21 "..\..\MainWindow.xaml"
     ((SMSGatewayWpf.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.MetroWindow_Closing);
     
     #line default
     #line hidden
     return;
     case 2:
     this.commands = ((MahApps.Metro.Controls.WindowCommands)(target));
     return;
     case 3:
     this.btnSettings = ((System.Windows.Controls.Button)(target));
     
     #line 56 "..\..\MainWindow.xaml"
     this.btnSettings.Click += new System.Windows.RoutedEventHandler(this.btnSettings_Click);
     
     #line default
     #line hidden
     return;
     case 4:
     this.btnAbout = ((System.Windows.Controls.Button)(target));
     
     #line 57 "..\..\MainWindow.xaml"
     this.btnAbout.Click += new System.Windows.RoutedEventHandler(this.btnAbout_Click);
     
     #line default
     #line hidden
     return;
     case 5:
     this.transitionContentHome = ((MahApps.Metro.Controls.TransitioningContentControl)(target));
     return;
     }
     this._contentLoaded = true;
 }
Esempio n. 13
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (LeftWindowCommands == null)
            {
                LeftWindowCommands = new WindowCommands();
            }
            if (RightWindowCommands == null)
            {
                RightWindowCommands = new WindowCommands();
            }

            LeftWindowCommandsPresenter  = GetTemplateChild(PART_LeftWindowCommands) as ContentPresenter;
            RightWindowCommandsPresenter = GetTemplateChild(PART_RightWindowCommands) as ContentPresenter;
            WindowButtonCommands         = GetTemplateChild(PART_WindowButtonCommands) as WindowButtonCommands;

            overlayBox                    = GetTemplateChild(PART_OverlayBox) as Grid;
            metroDialogContainer          = GetTemplateChild(PART_MetroDialogContainer) as Grid;
            flyoutModal                   = GetTemplateChild(PART_FlyoutModal) as Rectangle;
            flyoutModal.PreviewMouseDown += FlyoutsPreviewMouseDown;
            this.PreviewMouseDown        += FlyoutsPreviewMouseDown;

            icon               = GetTemplateChild(PART_Icon) as UIElement;
            titleBar           = GetTemplateChild(PART_TitleBar) as UIElement;
            titleBarBackground = GetTemplateChild(PART_WindowTitleBackground) as UIElement;

            this.ToggleVisibiltyForAllTitleElements(this.TitlebarHeight > 0);

            if (icon != null && icon.Visibility == Visibility.Visible)
            {
                icon.MouseDown += IconMouseDown;
                icon.MouseUp   += IconMouseUp;
            }

            // handle mouse events if title template use HorizontalAlignment != Center
            if (titleBarBackground != null && titleBarBackground.Visibility == Visibility.Visible)
            {
                titleBarBackground.MouseDown += TitleBarMouseDown;
                titleBarBackground.MouseUp   += TitleBarMouseUp;
                titleBarBackground.MouseMove += TitleBarMouseMove;
            }

            if (titleBar != null && titleBar.Visibility == Visibility.Visible)
            {
                titleBar.MouseDown += TitleBarMouseDown;
                titleBar.MouseUp   += TitleBarMouseUp;
                titleBar.MouseMove += TitleBarMouseMove;

                if (titleBar.GetType() == typeof(Grid))
                {
                    SizeChanged += this.MetroWindow_SizeChanged;
                }
            }
            else
            {
                MouseDown += TitleBarMouseDown;
                MouseUp   += TitleBarMouseUp;
                MouseMove += TitleBarMouseMove;
            }
        }