Skip to content

Button.CanClick property

Asked whether the button can be clicked, for a button whose condition is local enough that a command would be ceremony. Combined with IsEnabled and with the command’s own answer rather than replacing either, so any of the three disables the button.

public Func<bool>? CanClick { get; set; }

A predicate carries no change signal. It is asked again when the command system re-evaluates and when RequerySuggested is called; a condition that changes on its own must be pushed with one of those, or expressed as a binding to IsEnabled instead.