diff --git a/Dapplo.CaliburnMicro.Demo/Dapplo.CaliburnMicro.Demo.csproj b/Dapplo.CaliburnMicro.Demo/Dapplo.CaliburnMicro.Demo.csproj
index cb7c3c77..81729d70 100644
--- a/Dapplo.CaliburnMicro.Demo/Dapplo.CaliburnMicro.Demo.csproj
+++ b/Dapplo.CaliburnMicro.Demo/Dapplo.CaliburnMicro.Demo.csproj
@@ -128,7 +128,6 @@
-
@@ -183,10 +182,6 @@
DesignerMSBuild:Compile
-
- Designer
- MSBuild:Compile
- DesignerMSBuild:Compile
diff --git a/Dapplo.CaliburnMicro.Demo/Startup.cs b/Dapplo.CaliburnMicro.Demo/Startup.cs
index 05c406e2..3e694f80 100644
--- a/Dapplo.CaliburnMicro.Demo/Startup.cs
+++ b/Dapplo.CaliburnMicro.Demo/Startup.cs
@@ -26,8 +26,10 @@
#region Usings
using System;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Windows;
+using Dapplo.CaliburnMicro.Metro;
using Dapplo.Log.Facade;
using Dapplo.Log.Loggers;
@@ -38,8 +40,17 @@ namespace Dapplo.CaliburnMicro.Demo
///
/// This takes care or starting the Application
///
+ [Export]
public class Startup
{
+ ///
+ /// Example to show how to change the theme, change the following 2 values
+ ///
+ [Export]
+ public Themes Theme { get; } = Themes.BaseLight;
+ [Export]
+ public ThemeAccents ThemeAccent { get; } = ThemeAccents.Orange;
+
///
/// Start the application
///
diff --git a/Dapplo.CaliburnMicro.Demo/ViewModels/CredentialsViewModel.cs b/Dapplo.CaliburnMicro.Demo/ViewModels/CredentialsViewModel.cs
index 38745b7e..b0c17ce2 100644
--- a/Dapplo.CaliburnMicro.Demo/ViewModels/CredentialsViewModel.cs
+++ b/Dapplo.CaliburnMicro.Demo/ViewModels/CredentialsViewModel.cs
@@ -53,9 +53,6 @@ public class CredentialsViewModel : Screen
[Import]
public ICredentialsTranslations CredentialsTranslations { get; set; }
- [Import]
- public DummyViewModel DummyVm { get; set; }
-
///
/// Password for a login
///
diff --git a/Dapplo.CaliburnMicro.Demo/ViewModels/DummyViewModel.cs b/Dapplo.CaliburnMicro.Demo/ViewModels/DummyViewModel.cs
deleted file mode 100644
index 8dc5e97b..00000000
--- a/Dapplo.CaliburnMicro.Demo/ViewModels/DummyViewModel.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-#region Dapplo 2016 - GNU Lesser General Public License
-
-// Dapplo - building blocks for .NET applications
-// Copyright (C) 2016 Dapplo
-//
-// For more information see: http://dapplo.net/
-// Dapplo repositories are hosted on GitHub: https://github.com/dapplo
-//
-// This file is part of Dapplo.CaliburnMicro
-//
-// Dapplo.CaliburnMicro is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Dapplo.CaliburnMicro is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have a copy of the GNU Lesser General Public License
-// along with Dapplo.CaliburnMicro. If not, see .
-
-#endregion
-
-#region Usings
-
-using System.ComponentModel.Composition;
-using Caliburn.Micro;
-
-#endregion
-
-namespace Dapplo.CaliburnMicro.Demo.ViewModels
-{
- [Export]
- public class DummyViewModel : Screen
- {
- }
-}
\ No newline at end of file
diff --git a/Dapplo.CaliburnMicro.Demo/Views/CredentialsView.xaml b/Dapplo.CaliburnMicro.Demo/Views/CredentialsView.xaml
index 97a52439..1963a5e1 100644
--- a/Dapplo.CaliburnMicro.Demo/Views/CredentialsView.xaml
+++ b/Dapplo.CaliburnMicro.Demo/Views/CredentialsView.xaml
@@ -18,6 +18,5 @@
-
\ No newline at end of file
diff --git a/Dapplo.CaliburnMicro.Demo/Views/DummyView.xaml b/Dapplo.CaliburnMicro.Demo/Views/DummyView.xaml
deleted file mode 100644
index 71d0e19d..00000000
--- a/Dapplo.CaliburnMicro.Demo/Views/DummyView.xaml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/Dapplo.CaliburnMicro.Metro/Dapplo.CaliburnMicro.Metro.csproj b/Dapplo.CaliburnMicro.Metro/Dapplo.CaliburnMicro.Metro.csproj
index 1036a0f2..f6a00661 100644
--- a/Dapplo.CaliburnMicro.Metro/Dapplo.CaliburnMicro.Metro.csproj
+++ b/Dapplo.CaliburnMicro.Metro/Dapplo.CaliburnMicro.Metro.csproj
@@ -70,6 +70,8 @@
+
+
diff --git a/Dapplo.CaliburnMicro.Metro/MetroWindowManager.cs b/Dapplo.CaliburnMicro.Metro/MetroWindowManager.cs
index 631183b6..1e39c72f 100644
--- a/Dapplo.CaliburnMicro.Metro/MetroWindowManager.cs
+++ b/Dapplo.CaliburnMicro.Metro/MetroWindowManager.cs
@@ -31,6 +31,7 @@
using System.Windows;
using System.Windows.Controls;
using Caliburn.Micro;
+using MahApps.Metro;
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
@@ -49,24 +50,18 @@ namespace Dapplo.CaliburnMicro.Metro
/// here
///
[Export(typeof(IWindowManager))]
- public class MetroWindowManager : WindowManager
+ public class MetroWindowManager : WindowManager, IPartImportsSatisfiedNotification
{
private static readonly string[] Styles =
{
- "Colors", "Fonts", "Controls", "Controls.AnimatedSingleRowTabControl", "Accents/Blue",
- "Accents/BaseLight"
+ "Colors", "Fonts", "Controls", "Controls.AnimatedSingleRowTabControl"
};
- ///
- /// Add all the resources to the Application
- ///
- public MetroWindowManager()
- {
- foreach (var style in Styles)
- {
- AddMahappsStyle(style);
- }
- }
+ [Import(AllowDefault = true)]
+ private ThemeAccents ThemeAccent { get; set; }
+
+ [Import(AllowDefault = true)]
+ private Themes Theme { get; set; }
///
/// Export the IDialogCoordinator of MahApps, so ViewModels can open MahApps dialogs
@@ -210,5 +205,27 @@ public static Uri CreateMahappStyleUri(string style)
{
return new Uri($"pack://application:,,,/MahApps.Metro;component/Styles/{style}.xaml", UriKind.RelativeOrAbsolute);
}
+
+ ///
+ /// Called when a part's imports have been satisfied and it is safe to use.
+ ///
+ public void OnImportsSatisfied()
+ {
+ foreach (var style in Styles)
+ {
+ AddMahappsStyle(style);
+ }
+ if (ThemeAccent == ThemeAccents.Default)
+ {
+ ThemeAccent = ThemeAccents.Blue;
+ }
+ if (Theme == Themes.Default)
+ {
+ Theme = Themes.BaseLight;
+ }
+
+ AddMahappsStyle($"Accents/{ThemeAccent}");
+ AddMahappsStyle($"Accents/{Theme}");
+ }
}
}
\ No newline at end of file
diff --git a/Dapplo.CaliburnMicro.Metro/ThemeAccents.cs b/Dapplo.CaliburnMicro.Metro/ThemeAccents.cs
new file mode 100644
index 00000000..ef9753da
--- /dev/null
+++ b/Dapplo.CaliburnMicro.Metro/ThemeAccents.cs
@@ -0,0 +1,56 @@
+// Dapplo - building blocks for desktop applications
+// Copyright (C) 2016 Dapplo
+//
+// For more information see: http://dapplo.net/
+// Dapplo repositories are hosted on GitHub: https://github.com/dapplo
+//
+// This file is part of Dapplo.CaliburnMicro
+//
+// Dapplo.CaliburnMicro is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Dapplo.CaliburnMicro is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have a copy of the GNU Lesser General Public License
+// along with Dapplo.CaliburnMicro. If not, see .
+
+namespace Dapplo.CaliburnMicro.Metro
+{
+ ///
+ /// The accents for MahApps
+ ///
+ public enum ThemeAccents
+ {
+#pragma warning disable 1591
+ Default,
+ Amber,
+ Blue,
+ Brown,
+ Cobalt,
+ Crimso,
+ Cyan,
+ Emerald,
+ Green,
+ Indigo,
+ Lime,
+ Magenta,
+ Mauve,
+ Olive,
+ Orange,
+ Pink,
+ Purple,
+ Red,
+ Sienna,
+ Steel,
+ Taupe,
+ Teal,
+ Violet,
+ Yellow
+#pragma warning restore 1591
+ }
+}
\ No newline at end of file
diff --git a/Dapplo.CaliburnMicro.Metro/Themes.cs b/Dapplo.CaliburnMicro.Metro/Themes.cs
new file mode 100644
index 00000000..ed9673ec
--- /dev/null
+++ b/Dapplo.CaliburnMicro.Metro/Themes.cs
@@ -0,0 +1,35 @@
+// Dapplo - building blocks for desktop applications
+// Copyright (C) 2016 Dapplo
+//
+// For more information see: http://dapplo.net/
+// Dapplo repositories are hosted on GitHub: https://github.com/dapplo
+//
+// This file is part of Dapplo.CaliburnMicro
+//
+// Dapplo.CaliburnMicro is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Dapplo.CaliburnMicro is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have a copy of the GNU Lesser General Public License
+// along with Dapplo.CaliburnMicro. If not, see .
+
+namespace Dapplo.CaliburnMicro.Metro
+{
+ ///
+ /// The themes for MahApps
+ ///
+ public enum Themes
+ {
+#pragma warning disable 1591
+ Default,
+ BaseDark,
+ BaseLight
+#pragma warning restore 1591
+ }
+}
\ No newline at end of file
diff --git a/Dapplo.CaliburnMicro/Wizard/Views/WizardProgressView.xaml b/Dapplo.CaliburnMicro/Wizard/Views/WizardProgressView.xaml
index 5b80ad90..929720df 100644
--- a/Dapplo.CaliburnMicro/Wizard/Views/WizardProgressView.xaml
+++ b/Dapplo.CaliburnMicro/Wizard/Views/WizardProgressView.xaml
@@ -49,7 +49,7 @@
@@ -65,7 +65,7 @@
-
+
@@ -120,7 +120,7 @@
-
+