Пример #1
0
        private void btnTheme_Click(object sender, RoutedEventArgs e)
        {
            if (Application.Current.Resources.MergedDictionaries[0].Source.ToString() == "Theme1.xaml")
            {
                Application.Current.Resources.MergedDictionaries.Clear();
                Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
                {
                    Source = new Uri("Theme2.xaml", UriKind.Relative)
                });
            }
            else
            {
                Application.Current.Resources.MergedDictionaries.Clear();
                Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary()
                {
                    Source = new Uri("Theme1.xaml", UriKind.Relative)
                });
            }

            if (isMaximized)
            {
                CommonWindowHelper.SetMaximizedBackground(maxBorder);
            }
            else
            {
                CommonWindowHelper.SetRestoredBackground(maxBorder);
            }
        }
Пример #2
0
        private void btnMaximize_Click(object sender, RoutedEventArgs e)
        {
            if (isMaximized)
            {
                Height = RestoredHeight;
                Width  = RestoredWidth;
                Left   = RestoredLeft;
                Top    = RestoredTop;

                isMaximized = false;
                CommonWindowHelper.SetRestoredBackground(maxBorder);
                btnMaximize.Style = (Style)App.Current.Resources["MaximizeButtonStyle"];
            }
            else
            {
                WindowStartupLocation = WindowStartupLocation.Manual;

                RestoredHeight = Height;
                RestoredWidth  = Width;
                RestoredLeft   = Left;
                RestoredTop    = Top;
                Height         = SystemParameters.WorkArea.Height;
                Width          = SystemParameters.WorkArea.Width;
                Left           = (SystemParameters.WorkArea.Location.X);
                Top            = (SystemParameters.WorkArea.Location.Y);
                isMaximized    = true;

                CommonWindowHelper.SetMaximizedBackground(maxBorder);
                btnMaximize.Style = (Style)App.Current.Resources["RestoreButtonStyle"];
            }
        }