RelayCommand is an implementation of the .NET ICommand interface made and described by WPF expert Josh Smith.
Questions tagged [relaycommand]
289 questions
0
votes
1 answer
Pass SynchronizationContext to ViewModel when it's in a different projects
I have WPF application implemented with classic MVVM pattern, however View, Model and ViewModel are three different projects in my solution.
I have well-known implementation of AsyncObservebleCollection in my ViewModel
public class MyVM :…

inside
- 3,047
- 10
- 49
- 75
0
votes
2 answers
Cannot convert lambda expression to type 'string' because it is not a delegate type RelayCommand Model
the following is my code and I did include both System.Linq and also System.Data, and I still get this error:
Cannot convert lambda expression to type 'string' because it is not a delegate type RelayCommand Model
I've searched all over the…
0
votes
1 answer
Send a FlipViewItem as a RelayCommandParameter in a Windows Store App
I am trying to send to a view model the current item of a FlipView control, using MVVM Light.
The XAML code representing the FlipView control is the following:

rhcpfan
- 557
- 7
- 19
0
votes
1 answer
Can you give the button content as a parameter with a RelayCommand?
I have a method that changes the color of some textblocks, can you give the content as a parameter (string) with a RelayCommand?
0
votes
3 answers
Reuse controls inside a usercontrol
I have a UserControl UserControl1 and a button inside the UserControl1. And I have a UserControl1ViewModel that has an ICommand property for the button. Using this command I need to call a method outside(from other VMs or VM of the MainWindow) the…

Lance
- 2,774
- 4
- 37
- 57
0
votes
1 answer
Multibinding Command Parameters
So I have a context menu for each individual listview item and the listview is bound to a user list. The context menu has a sub-menu that is bound to an observable collection of user statuses. I want to be able to pass the user id from the list…

JTester
- 463
- 1
- 8
- 19
0
votes
1 answer
get the selected row of datagrid i.e on click in mvvm
i want to get the selected row of datagrid i.e on click in mvvm.i have below code i want to use it in MVVM,but not able to do so.Please let me know how to convert below 3 line s in mvvm using relay comand and Icommand
DataRowView dataRow =…

user3386790
- 156
- 4
- 16
0
votes
1 answer
SelectedItem set after Right Click event on DataGrid
I have a DataGrid as below

Prisoner
- 1,839
- 2
- 22
- 38
0
votes
1 answer
RelayCommand not binding my object in the MainViewModel
Hello I'm new here and I'm trying to explain my problem in a good english because it's not my mother tongue :)
So I'm using MVVM Light and I have my RelayCommand :
private RelayCommand _SearchMethod;
public RelayCommand SearchMethod
{
…

Debuzz89
- 3
- 2
0
votes
1 answer
AppBarButton is not binding to MVVM Relay command in ListView
Hi I am trying to add AppBarButton in a ListView and binded command to RelayCommand in ViewModel here is my xaml code
…

Muhammad Saifullah
- 4,292
- 1
- 29
- 59
0
votes
1 answer
RelayCommand implementation : Object reference not set to an instance of an object
I have a WPF Project and I am using a RelayCommand for button click event.
Here is the constractor of my MainViewModel
private readonly DataService _dataService;
public MainWindowModel(DataService dataService)
{
_dataService =…

HXD
- 506
- 1
- 7
- 26
0
votes
3 answers
Setting SelectedItem of combo box in MVVM
I have a combo box, selectionchanged event of combo box attached with its respective command and upon changing the selected item(from the drop down list) command is firing as expected but not when I set the selected item from the code.
This is some…

Manvinder
- 4,495
- 16
- 53
- 100
0
votes
1 answer
WPF - Pass parameter to relaycommand within ItemsControl
I've got an ItemsControl for basically an array of comboboxes, textboxes and buttons:
The XAML for that bottom section is all within the ItemsControl: (Having a problem with the button, the last element)

odkken
- 329
- 1
- 9
0
votes
0 answers
RelayCommand has some invalid arguments
I must not be understanding commands.
I started by looking at this page
http://www.codeproject.com/Articles/238657/How-to-use-Commands-in-WPF
and for some reason, RelayCommand is saying that it has some invalid arguments, but I'm not sure why or…

user2013535
- 73
- 1
- 1
- 7
0
votes
1 answer
Close window MVVM style
I'm programming an application in WPF which uses the MVVM concept.
I'm trying to have no code-behind, and trying to keep my ViewModels and Views fully seperated. This means that I have to handle closing windows in xaml.
I want to execute a…

Jonas Jensen
- 77
- 2
- 9