diff --git a/src/Files.App/UserControls/StatusBarControl.xaml b/src/Files.App/UserControls/StatusBarControl.xaml index f5e51501dea1..3b59430851b3 100644 --- a/src/Files.App/UserControls/StatusBarControl.xaml +++ b/src/Files.App/UserControls/StatusBarControl.xaml @@ -143,7 +143,7 @@ x:Name="GitActionsPanel" Grid.Column="1" VerticalAlignment="Center" - x:Load="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToFalseConverter}}" + x:Load="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToFalseConverter}, FallbackValue=False}" Orientation="Horizontal" Spacing="4"> @@ -214,7 +214,7 @@ Background="Transparent" BorderBrush="Transparent" ToolTipService.ToolTip="{helpers:ResourceString Name=ManageBranches}" - Visibility="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToVisibilityCollapsedConverter}}"> + Visibility="{x:Bind DirectoryPropertiesViewModel.GitBranchDisplayName, Mode=OneWay, Converter={StaticResource NullToVisibilityCollapsedConverter}, FallbackValue=Collapsed}"> diff --git a/src/Files.App/UserControls/StatusBarControl.xaml.cs b/src/Files.App/UserControls/StatusBarControl.xaml.cs index 123f0d715431..b98850b61bcd 100644 --- a/src/Files.App/UserControls/StatusBarControl.xaml.cs +++ b/src/Files.App/UserControls/StatusBarControl.xaml.cs @@ -11,7 +11,7 @@ public sealed partial class StatusBarControl : UserControl { public ICommandManager Commands { get; } = Ioc.Default.GetRequiredService(); - public DirectoryPropertiesViewModel DirectoryPropertiesViewModel + public DirectoryPropertiesViewModel? DirectoryPropertiesViewModel { get => (DirectoryPropertiesViewModel)GetValue(DirectoryPropertiesViewModelProperty); set => SetValue(DirectoryPropertiesViewModelProperty, value); @@ -47,6 +47,9 @@ public StatusBarControl() private void BranchesFlyout_Opening(object sender, object e) { + if (DirectoryPropertiesViewModel is null) + return; + DirectoryPropertiesViewModel.ShowLocals = true; DirectoryPropertiesViewModel.SelectedBranchIndex = DirectoryPropertiesViewModel.ACTIVE_BRANCH_INDEX; }