RelayCommand is an implementation of the .NET ICommand interface made and described by WPF expert Josh Smith.
Questions tagged [relaycommand]
289 questions
2
votes
1 answer
Open a WPF Popup with a button
I'm trying to open a Popup with a button and have implemented a basic ICommand. The button is binded to the ICommand OpenPopupCommand while the Popup IsOpen attribute is binded to the "IsOpen" OnPropertyChanged. My thought process was to bind the…

jarheadWill
- 63
- 1
- 1
- 7
2
votes
0 answers
RelayCommand doesn't work in some computers
In DataGrid I have a column defined like this.
APPROACH
…

MistyK
- 6,055
- 2
- 42
- 76
2
votes
0 answers
c# exception thrown inside relaycommand unhandled by try catch inspite of try catch
I stumbled upon a weird exception problem while working on test methods. Basically, i throw an exception inside an if statement which isn't catched by the try-catch above it. All seems to be related to the GalaSoft.MvvmLight.Command.RelayCommand and…

SofuGD
- 43
- 7
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
Weird behavior of canExecute in Mvvmlight RelayCommand
I'm learning Mvvmlight,and quite confused about its canExecute of RelayCommand.
Basically,I have a Button and a PasswordBox in the view,and a Command in the viewModel.What I want is to disable the Button if the PasswordBox is empty.My solution is to…

Chenxiao
- 373
- 1
- 3
- 15
2
votes
1 answer
WPF command binding with input validation - how to enable the "save" button only if all input is valid
In my ViewModel I have implemented IDataErrorInfo interface (along with INotifyPropertyChanged). Input validation works as intended, I have no problems there.
I have this property as part of IDataErrorInfo
public string Error { get { return…

Saša Ćetković
- 885
- 9
- 21
2
votes
1 answer
RelayCommands get executed multiple times
I am using MVVM Light in a Windows Phone 7 (7.1 using the wp8 SDK and VS Ultimate 2012) application that asynchroneously retrieves data from a web service application. I use RelayCommands on each page that execute async methods to get the data then…

ZipionLive
- 722
- 1
- 12
- 23
2
votes
3 answers
Commands using Action<> and Func<>
I am working through MVVM Survival Guide for Enterprise Architectures in Silverlight and WPF and have hit a snag in the Command section. Specifically, it creates a command based on an Action

mcalex
- 6,628
- 5
- 50
- 80
2
votes
3 answers
When implementing ICommand in MVVM I'm missing something
I'm very new to C# and WPF in general, having come from a LAMP web application background. I've tried following a couple tutorials on the subject but they have left me stumped.…

lose_the_grimm
- 313
- 4
- 15
2
votes
1 answer
Pass parameters to RelayCommand in code behind
I know that there are multiple posts with similar titles all over SOF and Google, but please bear with me for a minute.
I am following this article to create a context menu for my gridview:…

Peter
- 249
- 3
- 11
2
votes
1 answer
relaycommand CanExecute returns incorrect value
I create a pretty standard MVVM Light RelayCommand, with the canExecute parameter being:
() => (customer.Regions.Count > 0)
when necessary I call RaiseCanExecuteChanged(); and the canExecute is not reevaluated correctly. I then also call it…

user1151923
- 1,853
- 6
- 28
- 44
2
votes
1 answer
Why not working: RelayCommand RaiseCanExecuteChanged
When I call the PressCommand.RaiseCanExecuteChanged(); in the TimerOnElapsed method, nothing happened.
What could be the problem?
(GalaSoft.MvvmLight.WPF4 v4.0.30319 and GalaSoft.MvvmLight.Extras.WPF4 v4.0.30319)
Here is my test code:
using…

Oszkar
- 1,603
- 3
- 15
- 17
2
votes
2 answers
Context-sensitive command with MVVM
I have a custom component that is basically a text box with an attached button. The button is supposed to perform an action on the text box; for example clicking the button could fill the text box with some random string.
The text fields are bound…

poke
- 369,085
- 72
- 557
- 602
2
votes
4 answers
How to create delegate from lambda expression with parameters?
I'm trying to create an instance of a RelayCommand with parameters dynamically:
public class RelayCommand : ICommand
{
#region Declarations
private readonly Predicate _canExecute;
private readonly Action _execute;
…

Adolfo Perez
- 2,834
- 4
- 41
- 61
2
votes
2 answers
usercontrol button binding not responding to relaycommand on mainviewmodel
I have a MainWindow bound to its mainViewModel. inside the MainWindow I have a usercontrol defind like this
inside that…

bewilderedprogrammer
- 137
- 1
- 6