mirror of
https://github.com/yaobiao131/downkyicore.git
synced 2025-08-10 00:52:31 +00:00
fix: 修复全选无效的问题 Fixed: #11
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user