Fix up NavigationVM not binding to NavigationView, fill icons on hover

This commit is contained in:
trawzified 2023-12-17 13:21:08 +01:00
parent 62edef8768
commit e42336131e
6 changed files with 42 additions and 10 deletions

View File

@ -1194,6 +1194,15 @@
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Resources>
<Style TargetType="ic:SymbolIcon">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Button, AncestorLevel=1}, Path=IsMouseOver}" Value="True">
<Setter Property="IsFilled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</Style.Resources>
</Style>
<Style x:Key="LargeButtonStyle" TargetType="{x:Type Button}">
<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}" />
@ -1306,6 +1315,15 @@
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Resources>
<Style TargetType="ic:SymbolIcon">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Button, AncestorLevel=1}, Path=IsMouseOver}" Value="True">
<Setter Property="IsFilled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</Style.Resources>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}" />
@ -1329,6 +1347,15 @@
<Setter Property="Focusable" Value="False" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Style.Resources>
<Style TargetType="ic:SymbolIcon">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Button, AncestorLevel=1}, Path=IsMouseOver}" Value="True">
<Setter Property="IsFilled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</Style.Resources>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource DisabledButtonForeground}" />

View File

@ -39,6 +39,9 @@ namespace Wabbajack
[Reactive]
public ViewModel ActivePane { get; private set; }
[Reactive]
public NavigationVM NavigationVM { get; private set; }
public ObservableCollectionExtended<IStatusMessage> Log { get; } = new ObservableCollectionExtended<IStatusMessage>();
public readonly CompilerVM Compiler;
@ -47,7 +50,6 @@ namespace Wabbajack
public readonly ModListGalleryVM Gallery;
public readonly ModeSelectionVM ModeSelectionVM;
public readonly WebBrowserVM WebBrowserVM;
public readonly NavigationVM NavigationVM;
public readonly Lazy<ModListContentsVM> ModListContentsVM;
public readonly UserInterventionHandlers UserInterventionHandlers;
private readonly Client _wjClient;

View File

@ -22,20 +22,22 @@ namespace Wabbajack
public class NavigationVM : ViewModel
{
private readonly ILogger<NavigationVM> _logger;
public ICommand BrowseCommand { get; }
public ICommand InstallCommand { get; }
public ICommand CompileCommand { get; }
public ReactiveCommand<Unit, Unit> UpdateCommand { get; }
public NavigationVM(ILogger<NavigationVM> logger)
{
_logger = logger;
HomeCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModeSelectionView));
BrowseCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModListGallery));
InstallCommand = ReactiveCommand.Create(() =>
{
LoadLastLoadedModlist.Send();
NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Installer);
});
CompileCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.Compiler));
BrowseCommand = ReactiveCommand.Create(() => NavigateToGlobal.Send(NavigateToGlobal.ScreenType.ModListGallery));
}
public ICommand HomeCommand { get; }
public ICommand BrowseCommand { get; }
public ICommand InstallCommand { get; }
public ICommand CompileCommand { get; }
public ReactiveCommand<Unit, Unit> UpdateCommand { get; }
}
}

View File

@ -63,7 +63,7 @@
<ColumnDefinition Width="128" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<local:NavigationView Grid.Column="0" />
<local:NavigationView Grid.Column="0" ViewModel="{Binding NavigationVM}" />
<Border Grid.Column="1" Margin="0" Background="{StaticResource ComplementaryBackgroundBrush}" x:Name="MainContent" Padding="28" CornerRadius="8">
<ContentPresenter Content="{Binding ActivePane}" VerticalAlignment="Stretch">
<ContentPresenter.Resources>

View File

@ -27,6 +27,7 @@ namespace Wabbajack
public ModeSelectionView()
{
InitializeComponent();
var vm = ViewModel;
this.WhenActivated(dispose =>
{
this.WhenAnyValue(x => x.ViewModel.Modlists)

View File

@ -19,10 +19,10 @@ namespace Wabbajack
InitializeComponent();
this.WhenActivated(dispose =>
{
this.WhenAny(x => x.ViewModel.BrowseCommand)
.BindToStrict(this, x => x.BrowseButton.Command)
this.BindCommand(ViewModel, vm => vm.BrowseCommand, v => v.BrowseButton)
.DisposeWith(dispose);
this.BindCommand(ViewModel, vm => vm.HomeCommand, v => v.HomeButton)
.DisposeWith(dispose);
/*
this.WhenAny(x => x.ViewModel.InstallCommand)
.BindToStrict(this, x => x.InstallButton.Command)