WPF design pattern that provides a generic reusable implementation of ICommand. Versions of this object can be found in the versions of Microsoft Prism.
Questions tagged [delegatecommand]
100 questions
4
votes
3 answers
jQuery: live() and delegate()
I'm binding a click event to a div element, which is created after clicking on a button.
I'm using .live() and this is working.
I've heard, that I should not use .live, but .delegate().
So I've tried it, but it is not working, but .live is…

Keith L.
- 2,084
- 11
- 41
- 64
4
votes
2 answers
WPF ToggleButton and DelegateCommand
Is there a way to determine if a ToggleButton is Checked/Unchecked via DelegateCommands?
TIA,
mike
XAML code below. I'm using ItemsControl and binding to a collection. I'm basically wanting a way to get the toggle status of each button when it's…

Mike
- 41
- 1
- 3
3
votes
1 answer
Is a DelegateCommand the same as an "Attached Behavior"?
I have been using the DelegateCommand found in the MVVM Visual Studio template at CodePlex. This works very nicely for having Views be able to execute commands on their ViewModel.
I read somewhere that in MVVM "attached behaviors" should be used. As…

Edward Tanguay
- 189,012
- 314
- 712
- 1,047
3
votes
1 answer
How is the standard DelegateCommand CanExecuteChanged event fired in Silverlight?
I want to re-trigger the canExecute functionality from a DelegateCommand after some modifications have been made by the user. How do I do this?

Nathan Tregillus
- 6,006
- 3
- 52
- 91
3
votes
1 answer
Why do Prism DelegateCommands sometimes cause threading exceptions?
The example below uses the DelegateCommand from Prism 6.1, but I've produced the same issue with 5.0.
Using the following view-model (view omitted, just consists of 2 buttons):
public class MainWindowViewModel
{
public DelegateCommand…

Tony Harrison
- 68
- 2
- 7
3
votes
1 answer
Raise CanExecuteChanged when the model changes
In my ViewModel I have an ObservableCollection of Person objects (that implement INotifyPropertyChanged) and a SelectedPerson property. These are bound to a ListBox in my view.
There is also the following Prism DelegateCommand in my…

Kurren
- 827
- 1
- 9
- 18
2
votes
3 answers
Working with DelegateCommand's CanExecute action
I've a ViewModel class like this in a Prism / WPF project.
public class ContentViewModel : ViewModelBase, IContentViewModel
{
public ContentViewModel(IPersonService personService)
{
Person = personService.GetPerson();
…

Raj
- 4,405
- 13
- 59
- 74
2
votes
3 answers
Invalid data in TextBox -- How to disable my command buttons?
Basically I have the following situation:
public Boolean CanDoCommand()
{
return (MyIntValue < 100);
}
public void DoCommand() { ... }
So here's the…

michael
- 14,844
- 28
- 89
- 177
2
votes
0 answers
Associate a keyboard shortcut with a DelegateCommand in WPF?
I am using Prism and have a CompositeCommand in an ApplicationCommands.cs class:
public CompositeCommand ShowSourceFormattingCommand { get; } = new CompositeCommand(true);
I have a DelegateCommand registered to this CompositeCommand:
public…

Sheridan
- 68,826
- 24
- 143
- 183
2
votes
1 answer
PRISM (ViewModel): Ensure a command does not get executed multiple times simultaneously
I'm trying to disable frequent user gestures so the same command does not get executed multiple times simultaneously.
private readonly SemaphoreSlim _semaphoreSlim = new SemaphoreSlim(1);
public bool MyCommandCanExecute { get; set; } =…

Mark13426
- 2,569
- 6
- 41
- 75
2
votes
2 answers
CompositeCommand wait for all Child Commands to complete
In my Dialog I have a TabControl with ChildViews using Prism. For the Save Commands I'm using a CompositeCommand. Everything works as expected.
The only problem is: I want to wait for every ChildViewModel to complete the async Save process and then…

Johannes Wanzek
- 2,825
- 2
- 29
- 47
2
votes
2 answers
WPF: CanExecute is Always Disabled
I've got a TextBox for the user to enter a string, and an "Add" button to perform some tasks with the value. I added a CanExecute method to the DelegateCommand so that the button would only work when there was text in the box.
However, it's…

Nightmare Games
- 2,205
- 6
- 28
- 46
2
votes
1 answer
Can't subscribe to DelegateCommand.CanExecuteChanged
I have two ViewModels and one contains another. The inner one has a Microsoft.Practices.Prism.Commands.DelegateCommand called PrintCommand. It is desirable to subscribe to the CanExecuteChanged event of this command. This part is implemented as…

dmigo
- 2,849
- 4
- 41
- 62
2
votes
1 answer
Why can't I bind my Silverlight Button Click to a Prism DelegateCommand
I have a simple test app in Silverlight 3 and Prism where I'm just trying to bind a button Click to a simple command I have created on a view model.
This is a test app just to get commanding working.
When I run it I get a binding error telling me…

Michael
- 41
- 4
2
votes
1 answer
DelegateCommand vs RoutedCommand and gestures - WPF
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…

devdigital
- 34,151
- 9
- 98
- 120