private void DeleteButtonOnClicked() { if (DeleteCommand != null && DeleteCommand.CanExecute(Product)) { DeleteCommand.Execute(Product); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); Focusable = true; IsHitTestVisible = true; //set the AllowDrop if (IsDrawLineDropEnabled) { this.AllowDrop = true; if (this.Content is UIElement) { SetContentAllowDrop(this.Content as UIElement); } } this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, (sender, e) => { DeleteCommand.Execute(DataContext); DeleteDiagramAndLines(); }, (sender, e) => { e.CanExecute = DeleteCommand?.CanExecute(DataContext) ?? false; } )); }
private void OnDelete(object sender, EventArgs e) { Image image = (Image)sender; image.SetAnimation(); if (DeleteCommand != null && DeleteCommand.CanExecute(ShoppingList)) { DeleteCommand.Execute(ShoppingList); } }
protected override void OnKeyDown(KeyEventArgs e) { if (e.Key == Key.Delete) { if (DeleteCommand != null && DeleteCommand.CanExecute(DataContext)) { DeleteCommand.Execute(DataContext); DeleteDiagramAndLines(); } } base.OnKeyDown(e); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.CommandBindings.Add(new CommandBinding(ApplicationCommands.Delete, (sender, e) => { DeleteCommand.Execute(DeleteCommandParameter); DeleteLine(); }, (sender, e) => { e.CanExecute = DeleteCommand?.CanExecute(DeleteCommandParameter) ?? false; } )); }
protected override void OnKeyDown(KeyEventArgs e) { if (e.Key == Key.Delete) { if (DeleteCommand?.CanExecute(DeleteCommandParameter) ?? false) { DeleteCommand.Execute(DeleteCommandParameter); DeleteLine(); } } else if (e.Key == Key.Enter) { if (DoubleClickCommand?.CanExecute(DoubleClickCommandParameter) ?? false) { DoubleClickCommand.Execute(DoubleClickCommandParameter); } } base.OnKeyDown(e); }