Skip to content

Commit

Permalink
Changed method to relay command.
Browse files Browse the repository at this point in the history
  • Loading branch information
Timthreetwelve committed Oct 15, 2024
1 parent e352984 commit bfad1d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions WUView/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<!--#region Interaction Triggers-->
<bh:Interaction.Triggers>
<bh:EventTrigger EventName="KeyDown">
<bh:CallMethodAction MethodName="KeyDown"
TargetObject="{Binding}" />
<bh:InvokeCommandAction Command="{Binding KeyDownCommand}"
PassEventArgsToCommand="True" />
</bh:EventTrigger>
</bh:Interaction.Triggers>
<!--#endregion-->
Expand Down
7 changes: 4 additions & 3 deletions WUView/ViewModels/NavigationViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Tim Kennedy. All Rights Reserved. Licensed under the MIT License.
// Copyright (c) Tim Kennedy. All Rights Reserved. Licensed under the MIT License.

namespace WUView.ViewModels;

Expand Down Expand Up @@ -264,7 +264,8 @@ private static void OpenAppFolder()
/// <summary>
/// Keyboard events
/// </summary>
public void KeyDown(object sender, KeyEventArgs e)
[RelayCommand]
private void KeyDown(KeyEventArgs e)
{
#region Keys without modifiers
if (e.Key == Key.F1)
Expand Down Expand Up @@ -320,7 +321,7 @@ public void KeyDown(object sender, KeyEventArgs e)
{
if (UserSettings.Setting!.DateFormat >= 9)
{
UserSettings.Setting!.DateFormat = 0;
UserSettings.Setting.DateFormat = 0;
}
else
{
Expand Down

0 comments on commit bfad1d7

Please sign in to comment.