This commit is contained in:
TheXamlGuy
2024-02-14 22:54:22 +00:00
parent 9fe2317c4f
commit cc61842c9a
23 changed files with 138 additions and 93 deletions
@@ -0,0 +1,19 @@
using Microsoft.UI.Xaml.Controls;
namespace Hyperbar.UI.Windows;
public class ContentControlHandler(IViewModelContentBinder viewModelContentBinder) :
INavigationHandler<ContentControl>
{
public Task Handle(Navigate<ContentControl> args,
CancellationToken cancellationToken)
{
if (args.Target is ContentControl contentControl)
{
contentControl.Content = args.View;
contentControl.DataContext = args.ViewModel;
}
return Task.CompletedTask;
}
}
-16
View File
@@ -1,23 +1,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Hyperbar.UI.Windows;
public class ContentControlHandler(IViewModelContentBinder viewModelContentBinder) :
INavigationHandler<ContentControl>
{
public Task Handle(Navigate<ContentControl> args,
CancellationToken cancellationToken)
{
if (args.Target is ContentControl contentControl)
{
contentControl.Content = args.View;
}
return Task.CompletedTask;
}
}
public class WindowHandler(IViewModelContentBinder viewModelContentBinder) :
INavigationHandler<Window>
{