Skip to content

Commit 682bd3c

Browse files
Fix: Fixed issue where Git buttons were incorrectly shown in the status bar (#12703)
1 parent 342b761 commit 682bd3c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Files.App/UserControls/StatusBarControl.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
x:Name="GitActionsPanel"
144144
Grid.Column="1"
145145
VerticalAlignment="Center"
146-
x:Load="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToFalseConverter}}"
146+
x:Load="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}"
147147
Orientation="Horizontal"
148148
Spacing="4">
149149

@@ -214,7 +214,7 @@
214214
Background="Transparent"
215215
BorderBrush="Transparent"
216216
ToolTipService.ToolTip="{helpers:ResourceString Name=ManageBranches}"
217-
Visibility="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToVisibilityCollapsedConverter}}">
217+
Visibility="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToVisibilityCollapsedConverter}, FallbackValue=Collapsed}">
218218

219219
<Button.Content>
220220
<StackPanel Orientation="Horizontal" Spacing="8">

src/Files.App/UserControls/StatusBarControl.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public sealed partial class StatusBarControl : UserControl
1111
{
1212
public ICommandManager Commands { get; } = Ioc.Default.GetRequiredService<ICommandManager>();
1313

14-
public DirectoryPropertiesViewModel DirectoryPropertiesViewModel
14+
public DirectoryPropertiesViewModel? DirectoryPropertiesViewModel
1515
{
1616
get => (DirectoryPropertiesViewModel)GetValue(DirectoryPropertiesViewModelProperty);
1717
set => SetValue(DirectoryPropertiesViewModelProperty, value);
@@ -47,6 +47,9 @@ public StatusBarControl()
4747

4848
private void BranchesFlyout_Opening(object sender, object e)
4949
{
50+
if (DirectoryPropertiesViewModel is null)
51+
return;
52+
5053
DirectoryPropertiesViewModel.ShowLocals = true;
5154
DirectoryPropertiesViewModel.SelectedBranchIndex = DirectoryPropertiesViewModel.ACTIVE_BRANCH_INDEX;
5255
}

0 commit comments

Comments
 (0)