Theme only partially applying

May 21, 2010 at 12:20 AM
Edited May 21, 2010 at 4:25 PM

This is driving me crazy because I can't figure out what the problem is. Moreover, I have the sneaking suspicion this is due to some deeper problem that happened a while ago. The problem is this: when I attempt to use the ExpressionDark theme, only some of it ends up getting applied (in particular, scroll bars, combo box) but things like buttons, check boxes and menu backgrounds keep looking like the default Aero style. Oddly, the menu selection highlight gets changed, as does the menu foreground color so I get this really odd effect of a dark highlight appearing over a mostly white menu.

When I say i have the suspicion this happened in the past, it's because I did something weird once with as I recall the Vista magnifier tool (I don't recall what, but I remember it changed EVERYTHING on my system--perhaps it was some font or dpi setting or something. When I changed it back, it didn't revert completely and I was left with an odd font for all of my files and everywhere in every program. Anyhow somehow I managed to get this to change back (I think I fiddled with font settings or something) but it still didn't end up feeling exactly right.

So I mention this of course because it may not be a bug in the theme, but if anyone knows what I can do to fix this please tell! I tried completely removing and reinstalling the .NET framework, but it still happens just the same.

Thanks for any help!!

Update: So it turns out it has nothing to do with that earlier problem I experienced as it is also happening on my netbook. So the question is what is wrong with my application that is preventing the theme from working properly? I have referenced WPFToolkit.dll and referenced ExpressionDark.xaml from my App.xaml's ResourceDictionary.

May 22, 2010 at 3:04 PM

Okay so I've got it mostly working by creating an empty project with no other dependencies, but still the ContextMenu is not looking right. As I mentioned, the menu items appear correct only when the mouse is hovering over them, but the menu itself is still coming from the system theme.

Is the theme supposed to support ContextMenus? Is there something specific I have to do to get them to work?

May 22, 2010 at 7:22 PM

I've come to the conclusion the theme does not actually support ContextMenu styling. Why, I don't know.

I managed to get it roughly working by adding some additional elements to the theme resource file. Here is what I added, in case anyone else wants to pursue this, though I have given up on it:

        TargetType="{x:Type ContextMenu}">
            Value="True" />
            Value="True" />
            Value="true" />
            Value="True" />
            Value="Top" />
            Value="0,2,0,2" />
            Value="true" />
                    TargetType="{x:Type ContextMenu}">
                            Background="{DynamicResource LightBrush}"
                            BitmapEffect="{DynamicResource PopupDropShadow}"
                                    Color="{DynamicResource WhiteColor}" />
                            KeyboardNavigation.DirectionalNavigation="Cycle" />
                                Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
I've decided to just use the buttons and checkboxes and stuff and stick to the system default for menus.