Skip to content

Commit 77b0ae2

Browse files
committed
Changed command CanExecute args to Predicate<T>
1 parent 820e078 commit 77b0ae2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Microsoft.Toolkit.Mvvm/Input/AsyncRelayCommand{T}.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public sealed class AsyncRelayCommand<T> : ObservableObject, IAsyncRelayCommand<
2929
/// <summary>
3030
/// The optional action to invoke when <see cref="CanExecute(T)"/> is used.
3131
/// </summary>
32-
private readonly Func<T, bool>? canExecute;
32+
private readonly Predicate<T>? canExecute;
3333

3434
/// <summary>
3535
/// The <see cref="CancellationTokenSource"/> instance to use to cancel <see cref="cancelableExecute"/>.
@@ -65,7 +65,7 @@ public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute)
6565
/// <param name="execute">The execution logic.</param>
6666
/// <param name="canExecute">The execution status logic.</param>
6767
/// <remarks>See notes in <see cref="RelayCommand{T}(Action{T})"/>.</remarks>
68-
public AsyncRelayCommand(Func<T, Task> execute, Func<T, bool> canExecute)
68+
public AsyncRelayCommand(Func<T, Task> execute, Predicate<T> canExecute)
6969
{
7070
this.execute = execute;
7171
this.canExecute = canExecute;
@@ -77,7 +77,7 @@ public AsyncRelayCommand(Func<T, Task> execute, Func<T, bool> canExecute)
7777
/// <param name="cancelableExecute">The cancelable execution logic.</param>
7878
/// <param name="canExecute">The execution status logic.</param>
7979
/// <remarks>See notes in <see cref="RelayCommand{T}(Action{T})"/>.</remarks>
80-
public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute, Func<T, bool> canExecute)
80+
public AsyncRelayCommand(Func<T, CancellationToken, Task> cancelableExecute, Predicate<T> canExecute)
8181
{
8282
this.cancelableExecute = cancelableExecute;
8383
this.canExecute = canExecute;

Microsoft.Toolkit.Mvvm/Input/RelayCommand{T}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public sealed class RelayCommand<T> : IRelayCommand<T>
2929
/// <summary>
3030
/// The optional action to invoke when <see cref="CanExecute(T)"/> is used.
3131
/// </summary>
32-
private readonly Func<T, bool>? canExecute;
32+
private readonly Predicate<T>? canExecute;
3333

3434
/// <inheritdoc/>
3535
public event EventHandler? CanExecuteChanged;
@@ -54,7 +54,7 @@ public RelayCommand(Action<T> execute)
5454
/// <param name="execute">The execution logic.</param>
5555
/// <param name="canExecute">The execution status logic.</param>
5656
/// <remarks>See notes in <see cref="RelayCommand{T}(Action{T})"/>.</remarks>
57-
public RelayCommand(Action<T> execute, Func<T, bool> canExecute)
57+
public RelayCommand(Action<T> execute, Predicate<T> canExecute)
5858
{
5959
this.execute = execute;
6060
this.canExecute = canExecute;

0 commit comments

Comments
 (0)