This project is read-only.

Display problem with Control Styles in Change Set 54875

Oct 29, 2010 at 9:50 PM
Edited Oct 29, 2010 at 10:06 PM

I have my default themes set to Silver. If you change theme styles from Silver to Blue or even Black everything seems fine but when you return to Silver, my button styles return to default as if no styles are applied to them.

This is with my styles working.

 


 

This is after changing to blue and black and maybe blue then silver.

If you click between them at least twice I think this happens. Changing from Silver to Blue or black once then back to Silver doesn't seem to have this happen.

Oct 31, 2010 at 1:21 PM
Edited Oct 31, 2010 at 1:57 PM

Can anyone else  confirm they are having this issue with they're style buttons?

 

Perhaps it's where I'm placing my custom styles?

Here is my App.xaml code:

 

<Application x:Class="Manufactured_Housing_Manager_2011.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <!--Attach Default Fluent Control's Theme-->
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Black.xaml" />
                    <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Blue.xaml" />
                    <ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml" />
                    <ResourceDictionary Source="CustomStyles.xaml" />
                    <ResourceDictionary Source="Simple Styles.xaml"/>
                </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

My Button Style is inside CustomStyles.xaml

Nov 1, 2010 at 6:05 AM

You do not give the code where you change style, but I think you add a new Fluent dictionary in the end, so the order of styles is changed. Try to use 'insert' method instead 'add' or another way to preserve the order.

Nov 1, 2010 at 10:39 PM

Thanks that preserved my custom styles by using insert, but now I lose the Blue color I was using for the Backstage tab color and Image. It becomes red. 

Also there is no selected tab when my options window closes and it returns to the main Window.

This almost random behavior though, as I can change between then and it will sometimes give me my blue style corners and show the tabs correctly.

Here is the code I am using to change the style.

 

        void Options_Loaded(object sender, EventArgs e)
        {
            comboBoxScheme.SelectedIndex = Properties.Settings.Default.currentTheme;
        }


        private void OptionsClose_Click(object sender, RoutedEventArgs e)
        {
            switch (comboBoxScheme.SelectedIndex)
            {
                case 0:
                    System.Windows.Application.Current.Resources.BeginInit();
                    System.Windows.Application.Current.Resources.MergedDictionaries.Insert(0,new ResourceDictionary() { Source = new Uri("pack://application:,,,/Fluent;component/Themes/Office2010/Blue.xaml") });
                    System.Windows.Application.Current.Resources.MergedDictionaries.RemoveAt(1);
                    System.Windows.Application.Current.Resources.EndInit();
                    Properties.Settings.Default.currentTheme = comboBoxScheme.SelectedIndex;
                    break;
                case 1:
                    System.Windows.Application.Current.Resources.BeginInit();
                    System.Windows.Application.Current.Resources.MergedDictionaries.Insert(0, new ResourceDictionary() { Source = new Uri("pack://application:,,,/Fluent;component/Themes/Office2010/Silver.xaml") });
                    System.Windows.Application.Current.Resources.MergedDictionaries.RemoveAt(1);
                    System.Windows.Application.Current.Resources.EndInit();
                    Properties.Settings.Default.currentTheme = comboBoxScheme.SelectedIndex;
                    break;
                case 2:
                    System.Windows.Application.Current.Resources.BeginInit();
                    System.Windows.Application.Current.Resources.MergedDictionaries.Insert(0, new ResourceDictionary() { Source = new Uri("pack://application:,,,/Fluent;component/Themes/Office2010/Black.xaml") });
                    System.Windows.Application.Current.Resources.MergedDictionaries.RemoveAt(1);
                    System.Windows.Application.Current.Resources.EndInit();
                    Properties.Settings.Default.currentTheme = comboBoxScheme.SelectedIndex;
                    break;
            }
            
            Close();
        }

 

Nov 2, 2010 at 3:23 AM

Ok, I guess it was on my end, seems to be working fine now.

So weird, but I am switching development between an AMD Quad core  Phenom desktop and am Acer dual-core Atom notebook.

Seems I experience lots of weird behavior on the Acer.