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
0
votes
2 answers

How do I get DelegateCommand CanExecute to update WPF UI using MVVM?

Working off of this question, I'm attempting to make a UI with two buttons. Pressing one button disables itself and enables the other. I'm using the MVVM pattern and DelegateCommand: MainWindow XAML
watkipet
  • 959
  • 12
  • 23
0
votes
2 answers

Xamarin Forms Prism Pass a property via CommandParameter

I don't know how I can pass a single property via CommandParameter to my Command function in the ViewModel. Now I pass the whole object (CategoryListItem) but I only need the value from the Id property. How can I achieve this? Class: public class…
Nanou Ponette
  • 1,372
  • 4
  • 22
  • 46
0
votes
1 answer

How to test async void DelegateCommand method containing await with xUnit?

It is my first time when I write unit tests for async method. I am using xUnit. I searched SO with no promissing results. Best I found, but didnt work for me, is to implement IAsyncLifetime from THIS example. I will be thankful for any hints how to…
bakunet
  • 197
  • 1
  • 12
0
votes
4 answers

How to implement if, else statement in CanExecute command or Delegate command in wpf c#?

I'm new to WPF and Prism. How do I use an if else statement when using CommandCanExecute(), CommandExecute()/Delegate commands? I have a code to load and get the instance of livechart. However, if the file for the chart does not exist in the users…
0
votes
1 answer

wpf DelegateCommand return not fire

I'm using Mvvm pattern and in View when the UserControl-Initialized event is binding to InitializedCommand as below.
HyunYoung Go
  • 103
  • 9
0
votes
1 answer

How to enable KeyBinding for DelegateCommand in Prism 4?

I would like to enable a KeyBinding for a DelegateCommand in a Prism4 desktop application. For example, in my XAML file I have this:
Tom
  • 1
  • 1
  • 1
0
votes
1 answer

Implementing RaiseCanExecuteChanged method inside setter of a class object

I am still not sure if my approach is correct, but in an attempt to implement the MVVM pattern, I have created a model class 'Test' in the following way: public class Test : BindableBase { private int testNumber; public int TestNumber { …
r_laezza
  • 119
  • 1
  • 2
  • 14
0
votes
3 answers

WPF How to execute command for current active tabitem?

I'm using prism TabControl Region inside the shell view. Each TabItem contains AView and AViewModel. I can determine the currently active TabItem using a property IsActive property in AViewModel. IsActive property is set to true only for the current…
IBRA
  • 1,502
  • 3
  • 24
  • 56
0
votes
2 answers

Can execute question using delegate commands in prism

This seems like a dumb question but I have looked through the docs for prism and searched the internet and can't find an example... Here is the deal. I am using a DelegateCommand in Prism, it is working fine except when I assign a delegate to the…
Kenn
  • 2,709
  • 2
  • 29
  • 60
0
votes
1 answer

In WPF/Prism, what happens with a CompositeCommand when a DelegateCommand.RaiseCanExecuteChanged is fired?

Say that I have a CompositeCommand with a lot of DelegateCommands registered. If one of the child DelegateCommands fires up RaiseCanExecuteChanged, this will result in firing the event CompositeCommand.CanExecuteChanged, raising this same event in…
Carlos Melo
  • 3,052
  • 3
  • 37
  • 45
0
votes
1 answer

Exception Handling in Prism Async DelegateCommand

I am having a lot of troubles to catch an exception in a async DelegateCommand (Prism 5). In constructor of the ViewModel: cmdModificarPedido = New DelegateCommand(Of Object)(AddressOf OnModificarPedido, AddressOf CanModificarPedido) In the…
Carlos
  • 1,638
  • 5
  • 21
  • 39
0
votes
1 answer

Why is this command not invoked?

Here is what I consider the relevant part of the ListView in question:
ProfK
  • 49,207
  • 121
  • 399
  • 775
0
votes
0 answers

How can I notify the containing Window that a certain UserControl it contains invoked an ICommand/RelayCommand/DelegateCommand?

TL/DR: How can I notify the containing Window that a certain UserControl it contains invoked an ICommand/RelayCommand/DelegateCommand ? I want to respond the CanExecuteChanged events in the Window. Expansion: The UserControl:
Tar
  • 8,529
  • 9
  • 56
  • 127
0
votes
1 answer

DelegateCommand with another CanSee func except CanExecute

I want to create context menu item collection that each one of the item have header, command, can execute command and also to add a new feature for visibility that is also function like 'canExecute' but with other condition. When i'm pressing on a…
user436862
  • 867
  • 2
  • 15
  • 32
0
votes
1 answer

Populate a second DataGrid once I double click on a row WPF

I am still a little new to wpf and MVVM. I am trying to code a solution without breaking that pattern. I have two (well three, but for the scope of this question just two) DataGrids. I want to double click on the row of one, and from that load…
SoftwareSavant
  • 9,467
  • 27
  • 121
  • 195