diff --git a/Hyperbar.UI.Windows/ViewModelContentBinder.cs b/Hyperbar.UI.Windows/ViewModelContentBinder.cs index eeec6c5..38cfab7 100644 --- a/Hyperbar.UI.Windows/ViewModelContentBinder.cs +++ b/Hyperbar.UI.Windows/ViewModelContentBinder.cs @@ -3,27 +3,31 @@ using System.Reflection; namespace Hyperbar.UI.Windows; -public class ViewModelContentBinder(NavigationTargetCollection contents) : +public class ViewModelContentBinder(NavigationTargetCollection contents) : IViewModelContentBinder { public void Bind(FrameworkElement view, object context) { + if (context.GetType().GetCustomAttributes() is IEnumerable attributes) { foreach (NavigationTargetAttribute attribute in attributes) { - if (view.FindName(attribute.Name) is FrameworkElement content) + if (!contents.ContainsKey(attribute.Name)) { - contents.Add(attribute.Name, content); - void HandleUnloaded(object sender, RoutedEventArgs args) + if (view.FindName(attribute.Name) is FrameworkElement content) { - view.Unloaded -= HandleUnloaded; - contents.Remove(attribute.Name); - } + contents.Add(attribute.Name, content); + void HandleUnloaded(object sender, RoutedEventArgs args) + { + view.Unloaded -= HandleUnloaded; + contents.Remove(attribute.Name); + } - view.Unloaded += HandleUnloaded; + view.Unloaded += HandleUnloaded; + } } } } diff --git a/Hyperbar.Widget.MediaController.Windows/Hyperbar.Widget.MediaController.Windows.csproj b/Hyperbar.Widget.MediaController.Windows/Hyperbar.Widget.MediaController.Windows.csproj index dbcfbe4..9b7c887 100644 --- a/Hyperbar.Widget.MediaController.Windows/Hyperbar.Widget.MediaController.Windows.csproj +++ b/Hyperbar.Widget.MediaController.Windows/Hyperbar.Widget.MediaController.Windows.csproj @@ -9,14 +9,11 @@ enable - - - + - diff --git a/Hyperbar.Widget.MediaController.Windows/MediaButtonView.xaml b/Hyperbar.Widget.MediaController.Windows/MediaButtonView.xaml index a7f6759..478b9b7 100644 --- a/Hyperbar.Widget.MediaController.Windows/MediaButtonView.xaml +++ b/Hyperbar.Widget.MediaController.Windows/MediaButtonView.xaml @@ -5,7 +5,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:interactions="using:Microsoft.Xaml.Interactions.Core" xmlns:interactivity="using:Microsoft.Xaml.Interactivity" - xmlns:triggers="using:CommunityToolkit.WinUI.UI.Triggers"> + xmlns:triggers="using:CommunityToolkit.WinUI"> diff --git a/Hyperbar.Windows/SettingsView.xaml b/Hyperbar.Windows/SettingsView.xaml index 7ff7ec5..b49fa2e 100644 --- a/Hyperbar.Windows/SettingsView.xaml +++ b/Hyperbar.Windows/SettingsView.xaml @@ -6,11 +6,28 @@ - + + + + + + + + + + + + \ No newline at end of file diff --git a/Hyperbar.Windows/SettingsView.xaml.cs b/Hyperbar.Windows/SettingsView.xaml.cs index 5d5808c..7dba0d9 100644 --- a/Hyperbar.Windows/SettingsView.xaml.cs +++ b/Hyperbar.Windows/SettingsView.xaml.cs @@ -1,5 +1,6 @@ using Hyperbar.UI.Windows; using Microsoft.UI; +using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; namespace Hyperbar.Windows;