Esempio n. 1
0
 private void DeleteButtonOnClicked()
 {
     if (DeleteCommand != null && DeleteCommand.CanExecute(Product))
     {
         DeleteCommand.Execute(Product);
     }
 }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 4
0
        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (e.Key == Key.Delete)
            {
                if (DeleteCommand != null && DeleteCommand.CanExecute(DataContext))
                {
                    DeleteCommand.Execute(DataContext);
                    DeleteDiagramAndLines();
                }
            }

            base.OnKeyDown(e);
        }
Esempio n. 5
0
        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;
            }
                                                        ));
        }
Esempio n. 6
0
        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);
        }