fix: 修复全选无效的问题 Fixed: #11

This commit is contained in:
姚彪
2023-12-27 21:23:45 +08:00
parent e7077a65e5
commit ec68f26d9b
2 changed files with 32 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Avalonia.Controls;
using DownKyi.Core.BiliApi.BiliUtils;
using DownKyi.Core.BiliApi.VideoStream;
using DownKyi.Core.Logging;
@@ -416,6 +417,33 @@ public class ViewVideoDetailViewModel : ViewModelBase
}
}
// 全选事件
private DelegateCommand<object>? _selectAllCommand;
public DelegateCommand<object> SelectAllCommand => _selectAllCommand ??= new DelegateCommand<object>(ExecuteSelectAllCommand);
/// <summary>
/// 全选事件
/// </summary>
/// <param name="parameter"></param>
private void ExecuteSelectAllCommand(object parameter)
{
if (parameter is not DataGrid dataGrid)
{
return;
}
if (IsSelectAll)
{
dataGrid.SelectAll();
}
else
{
dataGrid.SelectedIndex = -1;
selectedVideoPages.Clear();
}
}
// 解析视频流事件
private DelegateCommand<object>? _parseCommand;

View File

@@ -430,11 +430,13 @@
Grid.Column="0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
CommandParameter="{Binding ElementName=NameVideoSections, Path=SelectedItem}"
Command="{Binding SelectAllCommand}"
CommandParameter="{Binding ElementName=NameVideoPages,Path=$self}"
Content="{DynamicResource SelectAll}"
Foreground="{DynamicResource BrushTextDark}"
IsChecked="{Binding IsSelectAll, Mode=TwoWay}"
Theme="{StaticResource CheckBoxStyle}" />
Theme="{StaticResource CheckBoxStyle}">
</CheckBox>
<Label
Grid.Column="3"
Margin="9,0,0,0"