Skip to content

Commit ba55bb7

Browse files
committed
Bind info bar open state to view model with x:Load
1 parent e42ac29 commit ba55bb7

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Files.App/ViewModels/Properties/HashesViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public HashInfoItem SelectedItem
2424

2525
public Dictionary<string, bool> ShowHashes { get; private set; }
2626

27+
public bool InfoBarVisible { get; set; }
28+
2729
public ICommand ToggleIsEnabledCommand { get; private set; }
2830

2931
private ListedItem _item;
@@ -33,6 +35,7 @@ public HashInfoItem SelectedItem
3335
public HashesViewModel(ListedItem item)
3436
{
3537
ToggleIsEnabledCommand = new RelayCommand<string>(ToggleIsEnabled);
38+
InfoBarVisible = false;
3639

3740
_item = item;
3841
_cancellationTokenSource = new();

src/Files.App/Views/Properties/HashesPage.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@
7575
Grid.Row="1"
7676
Grid.Column="0"
7777
Margin="12,75,12,12"
78+
x:Load="{x:Bind HashesViewModel.InfoBarVisible}"
7879
IsClosable="False"
79-
IsOpen="False"
80+
IsOpen="True"
8081
Message="No hashes match the provided hash."
8182
Severity="Informational" />
8283

src/Files.App/Views/Properties/HashesPage.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ private void HashInputTextBox_TextChanged(object sender, TextChangedEventArgs e)
6565
{
6666
HashMatchInfoBar.Severity = InfoBarSeverity.Error;
6767
HashMatchInfoBar.Title = Strings.HashesDoNotMatch.GetLocalizedResource();
68-
HashMatchInfoBar.IsOpen = true;
68+
HashesViewModel.InfoBarVisible = true;
6969
return;
7070
}
7171
else
7272
{
7373
HashMatchInfoBar.Severity = InfoBarSeverity.Success;
7474
HashMatchInfoBar.Title = string.Format(Strings.HashesMatch.GetLocalizedResource(), matchingAlgorithm);
75-
HashMatchInfoBar.IsOpen = true;
75+
HashesViewModel.InfoBarVisible = true;
7676
return;
7777
}
7878
}
@@ -93,7 +93,7 @@ private async void CompareFileButton_Click(object sender, RoutedEventArgs e)
9393
HashMatchInfoBar.Title = "no";
9494
}
9595

96-
HashMatchInfoBar.IsOpen = true;
96+
HashesViewModel.InfoBarVisible = true;
9797
}
9898

9999
private void MenuFlyout_Closing(FlyoutBase sender, FlyoutBaseClosingEventArgs e)

0 commit comments

Comments
 (0)