Reputation: 311
I really need your help in the subject.
I'm developing a WPF application. In my development machine I'm using Windows 7 with the Aero theme.
I've delivered the application to a colleague that was using Server 2008, without the Aero theme.
Well, the applications look & fell changed dramatically.
The main problem is that I'm not understanding the reason for some behaviors. Let's pick one that should be simply and that should be enough for me to understand the real problem: The Expander!
I'm using a lot of Expanders in a UserControl and I've declare the Expander style has:
<Style TargetType="Expander">
<Setter Property="Background" Value="#FF9B9B9B" />
<Setter Property="Padding" Value="0" />
</Style>
That looks great in my machine (Windows 7 with Aero). In my colleague machine the Background value is respected but the toggle button has a gray background border (which seems SystemColors.ControlBrushKey).
This with the Aero enabled, the way I want it:
And this what I'm getting with the Classic theme:
What am I doing wrong here? What can I do so that my application looks nice in Aero and in Classic?
If I ship the Aero XAML file with my application will it work on a XP machine?
Thanks
Upvotes: 1
Views: 3088
Reputation: 311
Looks like that I've found the problem. I don't quite understand why this has to be like this but.......
The problem was the style definition. It has to be something like:
<Style TargetType="{x:Type Expander}" BasedOn="{StaticResource {x:Type Expander}}">
Therefore, I'll have to analyze all the Styles that I've defined and add the 'BasedOn' property.
Thank you all.
Upvotes: 2
Reputation: 3111
Take a look at this blog post. It seems the author might have been able to solve this problem.
Upvotes: 3
Reputation: 8706
You can force the aero theme for a Window by adding a namespace
xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
This will work on XP machines as this is built into an assembly shipped with WPF.
Upvotes: 0