theme issue .. am I missing something

Apr 17, 2013 at 1:39 AM
nice toolkit .. really like it :-)

I think I'm probably missing something obvious. I followed the example (manually create everything - VS.NET2010) and it runs ok.

When I am in the VS designer, buttons appear properly with the modern UI styling, and I can change from light to dark - no issues. But, when I run the project (either in or outside VS), buttons, scrollbars, etc don't have Modern UI styling (they look like regular windows buttons). What am I missing?

Also noticed that all my StaticResource keys have underlines (not found).
Apr 17, 2013 at 5:19 AM
Ok .. after a bit of digging I found the answer. It's a bug in WPF 4.0. But there's a workaround.

In App.xaml, change this:
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.xaml" />
                <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.Light.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
to this:
    <Application.Resources>
        <ResourceDictionary>
            <Style TargetType="{x:Type Rectangle}" />
              <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.xaml" />
                <ResourceDictionary Source="/FirstFloor.ModernUI;component/Assets/ModernUI.Light.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
Note the extra 'Style' that doesn't do anything..
WPF4 has some issues traversing merged dictionaries. If you add the 'dummy' style in there, it seems to fix the issue. Go figure!
Coordinator
Apr 17, 2013 at 11:56 AM
Great job, much appreciated! I've updated the tutorials to include the empty Rectangle style.