
Hi Martin
In my application's Application.xaml I have the the following:
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Startup="Application_Startup">
<Application.Resources>
</Application.Resources>
</Application>
and in the application.xaml.vb file (I prefer vb) I have the following:
Imports ActiproSoftware.Windows.Themes
Private Sub Application_Startup(ByVal sender As Object, ByVal e As StartupEventArgs)
'configure theming to begin with
'
ThemeManager.BeginUpdate()
Try
ThemesMetroThemeCatalogRegistrar.Register()
' Use the Actipro styles for native WPF controls that look great with Actipro's control products
ThemeManager.AreNativeThemesEnabled = True
If (Environment.OSVersion.Version.Major > 6) OrElse ((Environment.OSVersion.Version.Major = 6) AndAlso (Environment.OSVersion.Version.Minor >= 2)) Then
ThemeManager.CurrentTheme = ThemeName.MetroWhite.ToString()
End If
Finally
ThemeManager.EndUpdate()
End Try
Dim viewmod As New MainRibbonViewModel
Dim frm As New MainRibbon With {.DataContext = viewmod, .WindowState=WindowState.Maximized}
frm.Show()
End Sub
in C# this would be:
using ActiproSoftware.Windows.Themes;
internal class Application
{
// Application-level events, such as Startup, Exit, and DispatcherUnhandledException
// can be handled in this file.
private void Application_Startup(object sender, StartupEventArgs e)
{
//configure theming to begin with
//
ThemeManager.BeginUpdate();
try
{
ThemesMetroThemeCatalogRegistrar.Register();
// Use the Actipro styles for native WPF controls that look great with Actipro's control products
ThemeManager.AreNativeThemesEnabled = true;
if ((Environment.OSVersion.Version.Major > 6) || ((Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor >= 2)))
{
ThemeManager.CurrentTheme = ThemeName.MetroWhite.ToString();
}
}
finally
{
ThemeManager.EndUpdate();
}
MainRibbonViewModel viewmod = new MainRibbonViewModel();
MainRibbon frm = new MainRibbon {DataContext = viewmod, WindowState = WindowState.Maximized};
frm.Show();
}
}
That should be sufficient to give you your metro theme (you'll obviously need to reference the relevant actipro assemblies, and add the necessary XLMNS: bits to your xaml).
Hope that helps
Dom