diff --git a/.gitignore b/.gitignore
index 4ce6fdd..2cfa8d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -337,4 +337,5 @@ ASALocalRun/
.localhistory/
# BeatPulse healthcheck temp database
-healthchecksdb
\ No newline at end of file
+healthchecksdb
+.ionide
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
index 79a5772..131a5a4 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
- "program": "${workspaceFolder}/App/bin/Debug/net5.0-windows10.0.18362.0/win-x64/ModernWpfPlayground.dll",
+ "program": "${workspaceFolder}/App/bin/Debug/net5.0-windows/win-x64/ModernWpfPlayground.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
diff --git a/App/App.xaml.cs b/App/App.xaml.cs
index 2fd2bdb..25cc284 100644
--- a/App/App.xaml.cs
+++ b/App/App.xaml.cs
@@ -1,5 +1,4 @@
-using System.Windows;
-using ModernWpf;
+using ModernWpf;
using ModernWpfPlayground.Types;
namespace ModernWpfPlayground
diff --git a/App/AssemblyInfo.cs b/App/AssemblyInfo.cs
index 2211234..9f33ab1 100644
--- a/App/AssemblyInfo.cs
+++ b/App/AssemblyInfo.cs
@@ -1,5 +1,3 @@
-using System.Windows;
-
[assembly:ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
@@ -7,4 +5,4 @@ using System.Windows;
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
-)]
+)]
\ No newline at end of file
diff --git a/App/ContentDialogExample.xaml.cs b/App/ContentDialogExample.xaml.cs
index 57994ad..3f61b02 100644
--- a/App/ContentDialogExample.xaml.cs
+++ b/App/ContentDialogExample.xaml.cs
@@ -1,6 +1,4 @@
-using System.Windows;
-
-namespace ModernWpfPlayground
+namespace ModernWpfPlayground
{
public partial class ContentDialogExample
{
diff --git a/App/GlobalUsings.cs b/App/GlobalUsings.cs
new file mode 100644
index 0000000..dab0812
--- /dev/null
+++ b/App/GlobalUsings.cs
@@ -0,0 +1,3 @@
+global using System;
+global using MvvmGen;
+global using System.Windows;
\ No newline at end of file
diff --git a/App/MainWindow.xaml b/App/MainWindow.xaml
index c29e8b9..6cfd1dc 100644
--- a/App/MainWindow.xaml
+++ b/App/MainWindow.xaml
@@ -22,22 +22,10 @@
-
-
-
-
-
-
+
+
+
@@ -58,7 +46,7 @@
-
+
@@ -220,7 +208,7 @@
-
+
@@ -246,12 +234,15 @@
-
+
-
+
+
+
diff --git a/App/MainWindowViewModel.cs b/App/MainWindowViewModel.cs
index 9e29762..c17dfe8 100644
--- a/App/MainWindowViewModel.cs
+++ b/App/MainWindowViewModel.cs
@@ -1,6 +1,4 @@
using ModernWpfPlayground.Types;
-using MvvmGen;
-using System.Windows;
using static ModernWpf.ThemeManager;
namespace ModernWpfPlayground
@@ -59,7 +57,7 @@ namespace ModernWpfPlayground
[Command]
private async void ShowDialog()
{
- var dialog = new ContentDialogExample {Message = WelcomeMessage};
+ var dialog = new ContentDialogExample { Message = WelcomeMessage };
var result = await dialog.ShowAsync();
WelcomeMessage = result.ToString();
}
@@ -83,6 +81,5 @@ namespace ModernWpfPlayground
//
// File.WriteAllText(Path, contents);
}
-
}
}
\ No newline at end of file
diff --git a/App/ModernWpfPlayground.csproj b/App/ModernWpfPlayground.csproj
index 54f5e04..e134061 100644
--- a/App/ModernWpfPlayground.csproj
+++ b/App/ModernWpfPlayground.csproj
@@ -2,27 +2,31 @@
WinExe
- net5.0-windows10.0.18362.0
+ net6.0-windows
true
enable
true
true
win-x64
- true
true
+ enable
-
+
-
+
+
+
+
+
\ No newline at end of file
diff --git a/App/MvvmStuff/DeserializationExtension.cs b/App/MvvmStuff/DeserializationExtension.cs
deleted file mode 100644
index 6aa1627..0000000
--- a/App/MvvmStuff/DeserializationExtension.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Globalization;
-
-namespace ModernWpfPlayground.MvvmStuff
-{
- public static class DeserializationExtension
- {
- public static object? Convert(object? value, Type propertyType)
- {
- if (value is null) return Activator.CreateInstance(propertyType);
-
- if (propertyType.IsEnum && value is string s)
- {
- return Enum.Parse(propertyType, s);
- }
-
- return System.Convert.ChangeType(value, propertyType, CultureInfo.InvariantCulture);
- }
- }
-}
\ No newline at end of file
diff --git a/App/PixelsToGridLengthConverter.cs b/App/PixelsToGridLengthConverter.cs
index 6ca2f6a..39dd0ab 100644
--- a/App/PixelsToGridLengthConverter.cs
+++ b/App/PixelsToGridLengthConverter.cs
@@ -1,12 +1,13 @@
-using System;
-using System.Globalization;
-using System.Windows;
+using System.Globalization;
using System.Windows.Data;
+using System.Windows.Markup;
namespace ModernWpfPlayground
{
- public class PixelsToGridLengthConverter : IValueConverter
+ public class PixelsToGridLengthConverter : MarkupExtension, IValueConverter
{
+ private static PixelsToGridLengthConverter? _converter;
+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is double d ? new GridLength(d) : new GridLength(1.0, GridUnitType.Auto);
@@ -16,5 +17,8 @@ namespace ModernWpfPlayground
{
throw new NotImplementedException();
}
+
+ public override object ProvideValue(IServiceProvider serviceProvider) =>
+ _converter ??= new PixelsToGridLengthConverter();
}
}
\ No newline at end of file
diff --git a/App/Types/AccentColors.cs b/App/Types/AccentColors.cs
index b4215aa..51c1a30 100644
--- a/App/Types/AccentColors.cs
+++ b/App/Types/AccentColors.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Media;
+using System.Windows.Media;
namespace ModernWpfPlayground.Types
{
diff --git a/App/Types/ThemeMode.cs b/App/Types/ThemeMode.cs
index 329eb85..d0ebf37 100644
--- a/App/Types/ThemeMode.cs
+++ b/App/Types/ThemeMode.cs
@@ -1,5 +1,4 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
using ModernWpf;
namespace ModernWpfPlayground.Types
diff --git a/Controls/Controls.csproj b/Controls/Controls.csproj
index b6510d6..3857f15 100644
--- a/Controls/Controls.csproj
+++ b/Controls/Controls.csproj
@@ -1,7 +1,7 @@
- net5.0-windows
+ net6.0-windows
true
enable
diff --git a/Controls/PropertyPresenter/EnumToKeyValueListConverter.cs b/Controls/PropertyPresenter/EnumToItemSourceConverter.cs
similarity index 79%
rename from Controls/PropertyPresenter/EnumToKeyValueListConverter.cs
rename to Controls/PropertyPresenter/EnumToItemSourceConverter.cs
index bb7fa9e..e7b5cce 100644
--- a/Controls/PropertyPresenter/EnumToKeyValueListConverter.cs
+++ b/Controls/PropertyPresenter/EnumToItemSourceConverter.cs
@@ -4,17 +4,20 @@ using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Windows.Data;
+using System.Windows.Markup;
namespace Controls
{
///
/// Converts enums to a List with KeyValuePairs.
///
- public class EnumToKeyValueListConverter : IValueConverter
+ public class EnumToItemSourceConverter : MarkupExtension, IValueConverter
{
+ private static EnumToItemSourceConverter? _converter;
+
object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
- if (!(value is Enum)) return Binding.DoNothing;
+ if (value is not Enum) return Binding.DoNothing;
return (from object enumValue in Enum.GetValues(value.GetType())
select new KeyValuePair(GetDescription(enumValue), enumValue)).ToList();
}
@@ -40,5 +43,7 @@ namespace Controls
{
return Binding.DoNothing;
}
+
+ public override object ProvideValue(IServiceProvider serviceProvider) => _converter ??= new EnumToItemSourceConverter();
}
}
\ No newline at end of file
diff --git a/Controls/PropertyPresenter/PropertyPresenter.xaml b/Controls/PropertyPresenter/PropertyPresenter.xaml
index 6d5aaba..469e757 100644
--- a/Controls/PropertyPresenter/PropertyPresenter.xaml
+++ b/Controls/PropertyPresenter/PropertyPresenter.xaml
@@ -86,12 +86,11 @@
-