Binds a RoutedCommand to the event handlers that implement the command.
Questions tagged [commandbinding]
201 questions
2
votes
0 answers
Is it possible to get any 'active' command bindings for a particular command?
We have a case where we have two externally-defined RoutedUICommand objects (i.e. we don't own them thus we can't change them) which come pre-wired to the same CTRL+N key binding. We can address that in our code by manually setting the InputBindings…

Mark A. Donohoe
- 28,442
- 25
- 137
- 286
2
votes
1 answer
DataGrid save button and CanExecute
I have a datagrid and save button in XAML. I have a ObservableCollection bound to a datagrid.
If I add/remove a row in datagrid, I should be able to enable the 'Save' Button to allow the user to save records. However the ObservableCollection's…

Kiddo
- 5,052
- 6
- 47
- 69
2
votes
1 answer
Execute command does not fire in resource dictionary code behind
I have created resource dictionary and code behind file for it.
In XAML I have defined command binding and added Executed handler:
2
votes
1 answer
WPF Command bindings - how can I get to event handlers
Hi
Is there any way to choose from where XAML should use command bindings event handlers?
I added copule of command binding to my cusotm control, however functions which are resonsible for execute and can_execute are not directly in code behind but…

wpflerner
- 21
- 2
2
votes
1 answer
How do I use StringFormat to get rid of the InputGesture text when a UI element is bound to a command?
I have a list of menu items that are bound to a string collection. Each of these menu items, when clicked, will fire my Open command. This is all working fine.
How do I omit the Ctrl+O next to each of these menu items?
Below is my XAML.
…

Dbloom
- 1,302
- 3
- 18
- 45
2
votes
0 answers
Command Binding WPF VB.NET
Help me resolve command binding issue that I'm having with ToggleHeightMeasurementOn Property (see code below). For some reasons, content binding is working, But command is not binding.
View Code

Honore Hodary
- 21
- 3
2
votes
1 answer
WPF menuitem shortcut. Strange behaviour
I create a menu item (context menu if that is of any help) using:
MenuItem menExit = new MenuItem();
menExit.Header = "Exit"; // will be changed later
menExit.Command = UICommands.CmdExit;
menExit.CommandBindings.Add(new…

Ulf Honkanen
- 119
- 1
- 8
2
votes
0 answers
CommandBindings as static resources in MenuItem
I was doing some test with CommandBindings modifying some code found in a book and I stumbled upon a problem.
I'd like to define a custom behaviour for the cut/copy/paste commands working both with the usual key combinations and context menu in a…

Matteo Meroni
- 51
- 4
2
votes
1 answer
Command Binding of Submenu item in Context Menu
I have a TreeView with an hierarchical Data Template (2 levels). I have a context menu created on the first level of the tree view with 3 levels. I want to bind a command of my view model to the second level of the context menu. Unfortunately I can…

SBa
- 43
- 1
- 5
2
votes
1 answer
When will the CanExcute event be raised by the CommandSource
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…

sudarsanyes
- 3,156
- 8
- 42
- 52
2
votes
2 answers
Invoking command on TextChange is not updating Text Source Immediately
I am using MVVM light in my windows phone 8.1 here is code
xaml

Muhammad Saifullah
- 4,292
- 1
- 29
- 59
2
votes
1 answer
MVVM Multiple Command Handlers
My Application layer uses DialogPresenters to show some ViewModels in various dialogs (modal, splash screen, etc..).
public DataImportDialogPresenter(DataImportViewModel viewModel, IDialogView shellView, IDialogView owner)
:…

djskinner
- 8,035
- 4
- 49
- 72
2
votes
2 answers
Bind ICommand in Converter
In my view I'm using an ItemsControl to display several Buttons. The XAML for the ItemsControl is:
…

Tomtom
- 9,087
- 7
- 52
- 95
2
votes
2 answers
Help binding command parameter to relative source
I have a ListBox that I have added a ContextMenu to. I want one of the items in the ContextMenu to be bound to a command and I want the parameter passed to that command to be the currently selected item of the ListBox control. Here's my…

Joe
- 447
- 2
- 8
- 15
2
votes
1 answer
Debugging CommandBinding's CanExecute
I have a user control with a Button bound to the NavigationCommands.RefreshCommand. The handler for the command is in the parent control. The handler's CanExecute looks like this:
e.CanExecute = !IsConnecting; // IsConnecting is a Dependency…

vanja.
- 2,532
- 3
- 23
- 39