RelayCommand is an implementation of the .NET ICommand interface made and described by WPF expert Josh Smith.
Questions tagged [relaycommand]
289 questions
1
vote
1 answer
Is it ok to have RelayCommand in View?
I have been in WPF for past few years but haven't done any of my projects from the scratch. Now, I got a chance to do so.
I have started to put some base before moving into project. I have created a separate WPF project for view and class library…

Gopichandar
- 2,742
- 2
- 24
- 54
1
vote
1 answer
C# MVVM: Edit a SelectedItem of an ObservableCollection with a RelayCommand
I am quiet new to programming and am currently learning C# and the MVVMC pattern (which is I think basically the same as MVVM pattern).
I need to code a database tool for ChiliPlants for university. There you should be able to edit an existing item…

ccdreyer
- 66
- 1
- 7
1
vote
1 answer
How to set boolean flag based on multiple property selections?
Overview:
I've bound the IsEnabled property of a button to a bool flag in it's related view model.
In the current UI setup the IsValidTagRequest should be set to true if all three properties have a selection, i.e RaisePropertyChanged() has fired in…

Brian Var
- 6,029
- 25
- 114
- 212
1
vote
2 answers
How to resolve an InvalidOperationException on Bool condition?
I've set up a bool property to prevent or allow a command to fire based on that bool being set to true.
In the current implementation, I check within the bool that certain values are not null before setting the bool to true.
Question:
Why do I get…

Brian Var
- 6,029
- 25
- 114
- 212
1
vote
2 answers
C#-WPF Strange async behavior
I've a strange behavior on my WPF window. To summarize, I have a WPF window that do an async stuff on loaded event
if (AppContext.OnlineMode)
Task.Run(() => SynchronizeMails());
This function (synchronizeMails), do a lot of stuff (async…

cdie
- 4,014
- 4
- 34
- 57
1
vote
2 answers
How to trigger a RelayCommand manually in WPF?
I have a code snippet as below:
XAML
...
…

Quan Nguyen
- 562
- 1
- 5
- 20
1
vote
3 answers
WPF Multibinding - Need to use Relaycommand
So, I have an element which has a command with 2 parameters to pass.
I previously did this with a snippet of code I found, but cannot for the life of me remember how to do it or find it again.
So, here is the multivalueconverter I previously…

pingu2k4
- 956
- 2
- 15
- 31
1
vote
1 answer
How to make command not disable button when clicked
I'm currently developping an application in MVVM.
I'm using for all buttons RelayCommand to perform action. The fact is that, with RelayCommand, the button is disabled when clicked on it, the time that the command is executing.
Because our rendering…

cdie
- 4,014
- 4
- 34
- 57
1
vote
0 answers
Propertychanged is null when RaisePropertyChanged
I'm making the game carcassonne and I'm using MVVM. So I have one window (ApplicationView) and several UserControls (for each view). The window contains al the viewModels and the views in Datacontext. In this window I use a ContentControl to display…

Brandon Pille
- 11
- 3
1
vote
2 answers
RelayCommand throws invalid cast exception
I'm trying to parameterize a RelayCommand but am getting a runtime cast exception.
Here are the relevant xaml and view model lines:
XAML
1
vote
3 answers
RelayCommand sender from ItemsControl item
I've been using MVVM's RelayCommand with success to bind actions to XAML, but I'm having a small problem with my ItemsControl.
…

Padu Merloti
- 3,219
- 3
- 33
- 44
1
vote
1 answer
Moving from RelayCommand to ReactiveCommand
I am in the process of learning ReactiveUI and I am starting with commands
I have trouble translating the code for this RelayCommand to the equivalent ReactiveCommand
GodkendeBilagCommand = new RelayCommand(OnGodkendeBilag,…

Martin Andersen
- 2,460
- 2
- 38
- 66
1
vote
1 answer
FileNotFoundException was unhandled - But the file is there
I'm struggling with this. My WPF app, in debug/release works fine. After I publish it, via InstallShield Express, I get a runtime exception and the program crashes.
When the program crashes, I can choose to debug the program in Visual Studio, it…

MyDaftQuestions
- 4,487
- 17
- 63
- 120
1
vote
0 answers
RelayCommand and popup in Windows Phone
I'm currently writing app for Windows Phone 8.0 and I have a problem with RelayCommand from MVVM Toolkit light and popup.
I have a LongListSelector on the popup:
…

Thomas
- 11
- 1
1
vote
3 answers
How to implement menuitems that depend on current selection in WPF MVVM explorer-like application
I am new to WPF and MVVM, and I am working on an application utilizing both. The application is similar to windows explorer, so consider an app with a main window with menu (ShellViewModel), a tree control (TreeViewModel), and a list control…

Doug
- 483
- 4
- 12