Skip to content

Commit

Permalink
fix: 修复全选无效的问题 Fixed: #11
Browse files Browse the repository at this point in the history
  • Loading branch information
yaobiao131 committed Dec 27, 2023
1 parent e7077a6 commit ec68f26
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
28 changes: 28 additions & 0 deletions DownKyi/ViewModels/ViewVideoDetailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
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;
Expand Down Expand Up @@ -416,6 +417,33 @@ private void ExecuteKeySelectAllCommand(object parameter)
}
}

// 全选事件
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;

Expand Down
6 changes: 4 additions & 2 deletions DownKyi/Views/ViewVideoDetail.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ec68f26

Please sign in to comment.