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]
95 questions
1
vote
1 answer
How can you unit test a DelegateCommand
I am trying to unit test my ViewModel and my SaveItem(save, CanSave) delegate command. I want to ensure that CanSave is called and returns the correct value given certain conditions. Basically, how can I invoke the delegate command from my unit…
![](../../users/profiles/164766.webp)
Damian
- 1,503
- 14
- 22
1
vote
1 answer
Delegated Command Doesnt Want To Work
Its been another long coding day and im probably over looking something.
But i cant figure out what ive missed
C# Code in ViewModel
public String MainWindowText { get; set; }
public DelegateCommand CommandClose { get; set; }
public…
![](../../users/profiles/3091374.webp)
New Bee
- 901
- 1
- 8
- 24
1
vote
1 answer
ICommandSource and DelegateCommand
I am trying to make a usercontrol with some commands. If I wire up the commands in xaml using the approach shown here http://msdn.microsoft.com/en-us/library/vstudio/ms771361(v=vs.90).aspx it works but if I use the DelegateCommand from the Prism…
![](../../users/profiles/402309.webp)
CodeHulk
- 111
- 1
- 12
1
vote
1 answer
Composite Commands Not Working
I am working on a Composite MVVM application and trying to get Global Binding events happening - Except it is NOT!..
the buttons are disabled by default although the CanRun returns true!! !! I have followed the Composite Guide and the OnLoadMenu is…
![](../../users/profiles/250516.webp)
Traci
- 858
- 1
- 13
- 29
1
vote
4 answers
Passing object type of parameter in a function called from Deleagte Command in WPF MVVM
Why does the following function take object type of parameters in WPF MVVM?
public ViewModel()
{
SaveCommand2 = new DelegateCommand(SaveCommand_Execute);
}
bool SaveCommand_CanExecute(object arg)
{
return Model.Name != string.Empty;
…
![](../../users/profiles/2546298.webp)
BAPSDude
- 321
- 1
- 3
- 15
1
vote
1 answer
Attach commands to TreeView in wpf using prism
How do I use a DelegateCommand in a TreeView to get the Expanded event?
Should I be using the DelegateCommand or is there another way?
Thanks
![](../../users/profiles/55474.webp)
user55474
- 527
- 8
- 25
1
vote
1 answer
Event handling in MVVM
In MVVM, Model will usually have the data model, view is UI (XAML) which is further binded to the properties VM, ViewModel which typically inherits INotifyPropertyChanged.
When it comes to event handling, are there any specific pattern to handle all…
![](../../users/profiles/248013.webp)
Amit
- 3,148
- 9
- 30
- 46
1
vote
2 answers
How can I set a breakpoint and have the code stop on a line inside an AttachedCommand?
In my XAML I have this command (which is an AttachedCommand which I got from http://marlongrech.wordpress.com):
![](../../users/profiles/4639.webp)
Edward Tanguay
- 176,854
- 291
- 683
- 1,015
1
vote
1 answer
Why this DelegateCommand does not refresh correctly the CanExecute with background workers?
Using a DelegateCommand in WPF I'm facing the following issue:
Executing the Command1 in a background worker prevents the window from refreshing correctly the CanExecute of the buttons, if the command is executed on the UI thread everything works as…
![](../../users/profiles/166452.webp)
Ignacio Soler Garcia
- 20,097
- 26
- 114
- 195
1
vote
1 answer
Using a DataForm and an external Save button
I have a DataForm with AutoCommit = "False" and an external Save button bound to a Command SaveCommand.
If I want the Save command disabled when no changes to the data (I'm using a ViewModel) are pending, when do I have to execute…
![](../../users/profiles/1353914.webp)
Rafael
- 1,333
- 3
- 18
- 37
1
vote
2 answers
Adding UserControl to a Canvas by a Command in ViewModel in WPF
I have a UserControl say Stock and it has a Button called Display
Now when i Click this button it should add an another UserControl named Display to the…
![](../../users/profiles/823369.webp)
Kishore Kumar
- 11,843
- 26
- 86
- 149
0
votes
1 answer
Why does DelegateCommand not work the same for Button and MenuItem?
This code shows that the Delegate Command from the Visual Studio MVVM template works differently when used with MenuItem and Button:
with Button, the command method has access to changed OnPropertyChanged values on the ViewModel
when using…
![](../../users/profiles/4639.webp)
Edward Tanguay
- 176,854
- 291
- 683
- 1,015
0
votes
1 answer
How to bind tooltip to a button for different conditions
How to bind tooltip dynamically for different conditions
we have 2 Projects in the solution v are using PRISM framework
GeneralBL contains the business logic and
StudentManagementUI contains the Usercontrols ,views and ViewModels
Have…
![](../../users/profiles/1016740.webp)
GANI
- 1,889
- 3
- 33
- 62
0
votes
1 answer
e.Tag DelegateCommand Binding
i have a little problem and find no way how to fix it. I create a Button with a Commandbinding. This Button calls a DelegateCommand, but i need the "e.Tag" of this button and DelegateCommand just return "null". So do any of you know a way to solve…
![](../../users/profiles/1205898.webp)
JakeFrost77
- 41
- 2
- 3
0
votes
1 answer
Scope for Actionscript 2.0 Event
I'm using Actionscript 2.0 for a mobile phone and can't get my head around Events.
I'm creating a class object with all my code and using a group of functions (all as direct 1st level children of the class). There's one function that creates a…
![](../../users/profiles/975080.webp)
Ferric
- 5
- 1