diff --git a/DownKyi/ViewModels/ViewVideoDetailViewModel.cs b/DownKyi/ViewModels/ViewVideoDetailViewModel.cs index adfd5cc..794214b 100644 --- a/DownKyi/ViewModels/ViewVideoDetailViewModel.cs +++ b/DownKyi/ViewModels/ViewVideoDetailViewModel.cs @@ -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? _selectAllCommand; + public DelegateCommand SelectAllCommand => _selectAllCommand ??= new DelegateCommand(ExecuteSelectAllCommand); + + /// + /// 全选事件 + /// + /// + private void ExecuteSelectAllCommand(object parameter) + { + if (parameter is not DataGrid dataGrid) + { + return; + } + + if (IsSelectAll) + { + dataGrid.SelectAll(); + } + else + { + dataGrid.SelectedIndex = -1; + selectedVideoPages.Clear(); + } + } + + // 解析视频流事件 private DelegateCommand? _parseCommand; diff --git a/DownKyi/Views/ViewVideoDetail.axaml b/DownKyi/Views/ViewVideoDetail.axaml index 3c3fd0c..6f30b9a 100644 --- a/DownKyi/Views/ViewVideoDetail.axaml +++ b/DownKyi/Views/ViewVideoDetail.axaml @@ -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}"> +