routed-commands

Xamly begin a storyboard when a RoutedCommand is called?

Is there a way to begin a storyboard wen an ICommand is executed WITH XAML? ...

How can a CanExecute of a commandBinding fire once the element has been removed from the visual tree?

I have a related question here where i have a user control with a command binding. The user control has being removed from the visual tree, yet the canExecute is still firing. My understanding of the Commanding model was that it bubbles and tunnels like routed events. So how can the CanExecute fire once the element with the command bindi...

WPF - how do I extend (or work in parallel with) the built-in command mechanism?

Please excuse me if this is a dumb question - I have read a dozen articles on the WPF command infrastructure and I am more confused than ever. I understand that I can use the built-in commands to implement (for example) a toolbar that will apply standard cut/copy/paste functionality to any focused textbox: <ToolBar> <Button Command...

How can I apply MVVM and Commands in this specific WPF situation?

I am having trouble with the MVVM pattern and Commands in my WPF app. The problem is not so much the MVVM pattern, but more the stuff that is going on on my GUI. I'll explain the situation: My app can DoStuff to some files. I have a class with a function DoStuff(int limit). My user user interface has the following items: A Button DoSt...

WPF command canExecute method isn't firing

Hi I have the following listbox template within a WPF Page I want the search button to only be enabled when a checkbox in the listbox has been checked. I am using the MVVM and have a seperate commands class Unfortunately the Canexecute method for my Search button is not being fired Mycommand is defined as public static readonly Rou...

DelegateCommand vs RoutedCommand and gestures - WPF

Hi, is there anyway for DelegateCommand's to support gestures when building a composite WPF app? I'm trying to create a command used by a MenuItem and also a Button, which can be accessed through a keyboard shortcut, but which sits inside a class in a separate assembly. I can use a RoutedCommand, but I want to minimise any code-behind....

WPF Two Commands handlers, One Command

Im deriving from a third party control. It is implementing ApplicationCommands.SelectAll. However the behaviour i want is slightly different. there is no virtual method i can override, and when i register a class handler, like so CommandManager.RegisterClassCommandBinding(typeof(MyDerivedControl), new CommandBinding(ApplicationComm...

Is it possible to have CommandManager requery only specific WPF command instead of all?

I'm trying to implement a highly responsive UI for my MVVM application, so I've chosen to have all command handlers automatically execute in a BackgroundWorker so they don't block the UI. But at the same time, I don't want the user to be able to execute the same command while it is still executing in the background. The solution seems o...

What should be owner type of a routed command?

I am using wpf Custom Commands. While writing a custom Command, one need to define the owner type. It's Description says that it is the type that is registering the command. I was seeing some sample of custom commands and there the Owner type was UIElement and in some others it was the class name itself. Whats the difference? What should...

How to fire a routed command from a specified event ?

Hello, I've a simple question about commands in WPF : I have a button with an ICommand bound to the Command property, and when I click on this button, the command is started, and wow it works :) Now I whant to start a particular command when I'm just pushing down the button (MouseLeftButtonDown event I think), but I don't know how can...

AvalonDock + UserControl + DataGrid + ContextMenu command routing issue

I'm getting weird behavior with command propagation from MenuItems of ContextMenu. I have the following kind of layout: ContextMenu is set for each DataGridRow of DataGrid inside UserControl, which in its turn is inside DockableContent of AvalonDock. If I get rid of either docking or UserControl around my grid there are no problems. Lis...

WPF - Set RelativeSource CommandTarget in RoutedCommand.Execute in code behind

I have a static class called commands. One the RoutedCommands in it is called ConfirmNoPrint. I want to Execute it in code behind from my custom control like this: Commands.ConfirmNoPrint.Execute(null, [WHAT_DO_I_PUT_HERE]); In the custom control class I have an instance of Binding whose RelativeSource property is set like this: _mai...

How to launch RoutedCommand on application level in multiple windows pattern?

I have a multiple windows in an application, for instance, window1, window2 and window3. one RoutedCommand (with KeyGesture F11) was binded in window1. How to launch that routed command by pressing F11, while window2 had input focus ? In WinForm application, i use MessageFilter to detect F11, but in WPF, how to do that ? ...

How to intercept execution of a RoutedCommand within the view? (WPF / MVVM)

In a WPF / MVVM application, I am trying to find a code-efficient way to set the main view cursor to Cursors.Wait prior to any lengthy operation and to restore it to the default cursor after completion. Since all operations are invoked using routed commands, I'd like to find a way of intercepting command execution, ideally by creating a...

RoutedCommand.CanExecuteChanged event not consistently firing inside ElementHost

(Background: I'm porting a WinForms app to WPF in stages. At the present time, I still have a WinForms main form with an ElementHost that has WPF content in it.) I'd like my app to be told when certain ApplicationCommands such as Cut, Copy, and Paste change the value of their .CanExecute. I thought it'd be a simple matter of subscribing...

When will the CanExcute event be raised by the CommandSource

Hi, When will the CanExecute event be ideally raised by the control that realizes the ICommandSource interface?? I tried to add a breakpoint to the handler to check when it is getting raised and it seems to be executed whenever the control is rendered on the screen. Can someone explain when exactly it will be raised and how to raise ...

Can I use Caliburn to bind to RoutedCommands?

What's the best way to use WPF's built-in RoutedCommands with Caliburn? For example, in my shell I have an Edit menu with a Copy item in it attached to the standard command found in ApplicationCommands: <Menu> <MenuItem Header="Edit"> <MenuItem Header="Copy" Command="ApplicationCommands.Copy" /> </Menu...

Find destination of a RoutedEvent

When I execute a routed command, let's say: ApplicationCommands.Undo.Execute(null, this); WPF does some magic to find the proper CommandBinding on which it executes the ExecutedRoutedEventHandler. Is there a way to get a reference to the CommandBinding (or at least to the handler) that would be executed? It would sometimes be nice...