Reputation: 21
I'm using custom MessageBox in my application and I need to apply my app style to it. So I use WPF Toolkit to create my MessageBox and I'm applying a MessageBoxStyle to my MessageBox :
C#:
Result = Xceed.Wpf.Toolkit.MessageBox.Show(
message,
title,
messageBoxButtons,
messageBoxImage,
(Style)resourceDictionary["MessageBoxStyle"]
);
XAML:
<Style x:Key="MessageBoxStyle" TargetType="{x:Type xctk:MessageBox}">
<!-- My Setters -->
</Style>
The problem is that it displays the basic Windows Vista window theme. I'd like my MessageBox to get the actual Windows theme of the machine (mine is Windows Server 2008 R2 E, but it might change if the application is run on another computer).
Is there a way to set this Windows theme "by default"?
Upvotes: 2
Views: 957
Reputation: 376
WPF comes with the standard Windows themes on all Windows versions. You can have Aero theme with following steps:
Source: http://mrpmorris.blogspot.com/2008/05/using-vista-aero-theme-in-xp-wpf-apps.html
Add PresentationFramework.Aero to your application's references list as a requires
Edit your App.xaml
<Application.Resources>
<ResourceDictionary>
<!-- Put your stuff here instead -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Other options are :
<ResourceDictionary Source="/PresentationFramework.Aero;component/themes/Aero.NormalColor.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Classic;component/themes/Classic.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Royale;component/themes/Royale.NormalColor.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Luna.Homestead;component/themes/Luna.Homestead.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Luna.Metallic;component/themes/Luna.Metallic.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Zune;component/themes/Zune.NormalColor.xaml"/>
Upvotes: 0