Questions tagged [delegatecommand]

WPF design pattern that provides a generic reusable implementation of ICommand. Versions of this object can be found in the versions of Microsoft Prism.

100 questions
2
votes
3 answers

How can I simplify the implementation of Commands in ViewModels for WPF/MVVM?

I have noticed that I am repeating a lot of code when implementing Commands on ViewModels for a MVVM-WPF scenario. The standard implementation, as shown below, consists of a public readonly field of type ICommand, a private DelegateCommand field and…
sammarcow
  • 2,736
  • 2
  • 28
  • 56
2
votes
1 answer

ContextMenu command binding

I have inherited a WPF application developed against an older version of Prism (Composite Application Guidance 1.0). The general pattern in this app is to use Microsoft.Practices.Composite.Wpf.DelegateCommand in the ViewModel and avoids code-behind…
grinder22
  • 551
  • 4
  • 17
1
vote
1 answer

How can I make Prism's DelegateCommand observe a child view-model's property?

My "parent" view-model (AnalyzeVm) has a child view-model (ScanVm) that represents something that can be saved to disk. I want to give the parent a command (SaveCmd) that is enabled only when the ScanVm.IsDirty property is true. I already use…
Joe
  • 5,394
  • 3
  • 23
  • 54
1
vote
1 answer

How to unit test CanExecuteChanged and RaisePropertyChanged

I am trying to practice strict TDD and have run into issue related to DelegateCommands and testing that CanExecute has been called. These are my two test titles: "When I select an item from the list I should be able to add child items" "When no…
Damian
  • 1,543
  • 15
  • 22
1
vote
2 answers

CommandParameter of event trigger using InvokeDelegateCommandAction

I am using the class InvokeDelegateCommandAction from AlexeyZakharov's weblog on the basis of some advice from guys that this is the best way to send back a parameter from a View to a ViewModel from an EventTrigger. Here's what I have. In the View…
tigerswithguitars
  • 2,497
  • 1
  • 31
  • 53
1
vote
1 answer

AutoProperties doesn't work with DelegateCommand.ObservesCanExecute in prism?

There is something under the hood that I don't understand with ObservesCanExecute on DelegateCommand in prism. It has something to see with AutoProperties ... I think I have a View with a button which is bound to a DelegateCommand in my…
Belight
  • 205
  • 2
  • 14
1
vote
2 answers

Async CanExecute method using DelegateCommand in MVVM

I have a simple DelegateCommand class that looks like this: public class DelegateCommand : System.Windows.Input.ICommand where T : class { public event EventHandler CanExecuteChanged; private readonly Predicate _canExecute; …
Maxim Gershkovich
  • 45,951
  • 44
  • 147
  • 243
1
vote
2 answers

Using .delegate in jQuery

I've got a function that works great on creating the custom tooltips I need for an event calendar. The problem is that when a user clicks to go to the next month on the calendar, a new set of links is made and jQuery is no longer selecting those…
Jarrod
  • 57
  • 1
  • 8
1
vote
0 answers

DelegateCommand in separate class first call of CanExecute parameter is null

I have the following problem. I have moved the DelegateCommand from the ViewModel to a separate class. And observe a property in the ViewModel. That works so far. Then CanExecute will call the first one with NULL when the view is initialized. Which…
ascholz
  • 179
  • 1
  • 9
1
vote
1 answer

Prism DelgateComand throws an exception

I have a static delegate command. I'm passing a bool to the constructor. However, it is throwing a runtime exception. public static class myViewModel { public static ICommand myCommand {get; private set;} static myViewModel { …
John
  • 101
  • 1
  • 11
1
vote
1 answer

WPF and MVVM problem

if try implemnt my first MVVM in WPF app. I have old app based on winforms and I want use my logic (class) from this project. I have Model, it consist with these classes: public class FriendData { //... } public class PingData { //... } public…
user481758
1
vote
2 answers

Prism: have to call RaiseCanExecuteChanged() explicitly

Below is a very simple Prism.Wpf example with a DelegateCommand that has both Execute and CanExecute delegates. Suppose that CanExecute depends on some property. It seems that Prism's DelegateCommand doesn't re-evaluate CanExecute condition…
mechanic
  • 761
  • 6
  • 11
1
vote
1 answer

Delegate command not executing on property change

I am currently trying to make a slider in ViewA change the font size of text in viewA and viewB. I have everything bound correctly, but the delegate command is not calling the execute method when the font size property is changed. If I manually call…
Methalous
  • 75
  • 8
1
vote
2 answers

How to make the CanExecute trigger properly using Prism 6

I have a Model public class Irritant : BindableBase { private short _id; private string _name; private string _description; public short Id { get { return _id; } set { SetProperty(ref _id, value); } } …
Pamingkas Sevada
  • 432
  • 9
  • 21
1
vote
2 answers

RaiseCanExecuteChanged not Working In Compiled exe But Does Work when Debugging

I have absolutely no idea what's causing this. Background: Using the Prism Framework I have a button bound to a DelegateCommand I call RaiseCanExecuteChanged When I start the app in debugging mode in Visual Studio, everything works perfectly.…
Bryant
  • 355
  • 9
  • 21