private void UpdateEnabledState() { this.Enabled = (!DisableWhenNoCommand && ClickCommand == null) || (ClickCommand != null && ClickCommand.CanExecute(ClickCommandParameter)); }
private async Task ButtonPressed() { await Animate(); if (ClickCommand != null && ClickCommand.CanExecute(ClickCommandParameter)) { ClickCommand.Execute(ClickCommandParameter); } }
private void AssociatedObject_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e) { if (ClickCommand == null || !ClickCommand.CanExecute(ClickCommandParameter)) { return; } ClickCommand.Execute(ClickCommandParameter); }
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); if (e.ClickCount == 1 && ((DragCommand != null && DragCommand.CanExecute(CommandParameter)) || (ClickCommand != null && ClickCommand.CanExecute(CommandParameter)))) { _mouseDownPoint = e.GetPosition(this); _isMouseDown = true; CaptureMouse(); } }
private void UpdateCursor() { Cursor = (DragCommand != null && DragCommand.CanExecute(CommandParameter)) || (ClickCommand != null && ClickCommand.CanExecute(CommandParameter)) ? Cursors.Hand : Cursors.Arrow; }