Change visible to condition for SecondaryItems

This commit is contained in:
Aleh Khantsevich
2024-04-26 14:30:00 +02:00
parent e92921a6cc
commit 2c4c7586b7
2 changed files with 5 additions and 3 deletions

View File

@@ -150,10 +150,11 @@
x:Name="RendererBar"
Grid.Row="0"
Margin="8,6,0,0"
IsSticky="False"
DefaultLabelPosition="Right"
HorizontalContentAlignment="Stretch"
OverflowButtonVisibility="Auto">
OverflowButtonVisibility="Auto"
DynamicOverflowItemsChanging="BarDynamicOverflowChanging"
IsDynamicOverflowEnabled="True">
<interactivity:Interaction.Behaviors>
<local:BindableCommandBarBehavior
ItemClickedCommand="{x:Bind ViewModel.OperationClickedCommand}"

View File

@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.AppCenter.Crashes;
@@ -218,7 +219,7 @@ namespace Wino.Views
private void BarDynamicOverflowChanging(CommandBar sender, DynamicOverflowItemsChangingEventArgs args)
{
if (args.Action == CommandBarDynamicOverflowAction.AddingToOverflow)
if (args.Action == CommandBarDynamicOverflowAction.AddingToOverflow || sender.SecondaryCommands.Any())
sender.OverflowButtonVisibility = CommandBarOverflowButtonVisibility.Visible;
else
sender.OverflowButtonVisibility = CommandBarOverflowButtonVisibility.Collapsed;