Questions tagged [relaycommand]

RelayCommand is an implementation of the .NET ICommand interface made and described by WPF expert Josh Smith.

289 questions
2
votes
2 answers

Correct way to use a Interaction Trigger on SelectionChanged Event

I have a command wired to the event such that it does fire, but what I get in the CommandParameter is the previously selected item, or maybe it's the selected item before the SelectionChanged completes. Either way, not sure what to change to get the…
Roger
  • 2,063
  • 4
  • 32
  • 65
2
votes
1 answer

WPF MVVM Multibinding - How to pass two parameters to Command using RelayCommand

How to pass 2 parameters to command using RelayCommand. I need to pass COntrols as parameters (Grid and Window). I'm fully aware that such kind of problem has already existed on Stack Overflow but I'm struggling with adjusting that to my needs. See…
M_K
  • 109
  • 1
  • 15
2
votes
1 answer

Full implementation of Relay Command - can it be applied to all cases?

I'm looking at the full implementation of a Relay Command that can be found here I heard that the idea behind RelayCommand is to have a sort of "universal remote control" to use on all your commands. If that is the case, I have 2 issues with the…
Maverick Meerkat
  • 5,737
  • 3
  • 47
  • 66
2
votes
0 answers

How to create RelayCommand With Optional Parameters

I'm trying to learn about the ICommand interface, and I'm getting a bit confused. What I want, is to have commands which don't require the object parameter because it's never used. class MainWindowViewModel { private int ZoomLevel { get; set;…
Ralt
  • 2,084
  • 1
  • 26
  • 38
2
votes
1 answer

Using RelayCommand to send complex data to a MVVM model

I have a complex query interface that I need to be passed on via a RelayCommand to my Model. This consists of some comboboxes, checkboxes and text inputs. I can easily pass on a single commandparameter (i.e. RelayCommand, etc), but how would I…
mmmm
  • 2,431
  • 2
  • 35
  • 56
2
votes
2 answers

How to bind Command to Check Box in ListView WPF?

Update I edited the code below to match the suggestions and it works correctly now. I've seen several stack overflow questions similar to this one, but I haven't quite been able to put it all together. I have the following xaml code.
Tim Hutchison
  • 3,483
  • 9
  • 40
  • 76
2
votes
2 answers

Relaycommand ICommand.CanExecute not firing

i have the following problem: I have a relaycommand with a execute an a canexecute method, but everytime i call raisecanexecutechanged(); it calls raisecanexecutechanged in relaycommand, sets a new delegate for it and then returns back to the view…
Revooo96
  • 31
  • 6
2
votes
2 answers

Passing an UIElement to the ViewModel using RelayCommand from MVVM-Light

In the start-screen of my program I am showing thumbnails of a (non-interactive) UserControl DocumentView to display different documents inside a Tile-like UserControl LoadTileView, on which the user can click to load the document into the main…
packoman
  • 1,230
  • 1
  • 16
  • 36
2
votes
2 answers

MVVM Master Detail with WPF TreeView

I have the following situation: Views: EbayCategoriesView (with a TreeView) MaintainEbayCategoryView (with the category detail fields) ViewModels: EbayAllCategoriesViewModel (with ObservableCollection of EbayCategoryViewModel called…
Alessandro
  • 35
  • 5
2
votes
2 answers

MVVMLight CanExecute not working until window click

Quick note so I do not waste anyone's time. When installing MVVMLight from nuget I eventually get an error null : The term 'null' is not recognized as the name of a cmdlet, function, script file, or operable program. MVVMLight seems to work fine…
Jeff
  • 1,727
  • 2
  • 17
  • 29
2
votes
1 answer

How do I write a Unit test for a RelayCommand that contains an Async Service Call?

I have a RelayCommand that I am trying to test. The RelayCommand contains a Service Call to Authenticate my user. Shown below: private MvxCommand _signIn; public MvxCommand SignIn { get { return _signIn ?? (_signIn = new…
JKennedy
  • 18,150
  • 17
  • 114
  • 198
2
votes
1 answer

RelayCommand canexecute never gets re-evaluated

I have an application, which uses RelayCommands in an MVVM architecture. It seems that at some point in time the CanExecute methods no longer get properly re-evaluated. (maybe installing latest updates for VS2013 caused this?). The code below seems…
bas
  • 13,550
  • 20
  • 69
  • 146
2
votes
1 answer

How to bind a RelayCommand(MVVM) to a RoutedCommand? (CommandBinding)

I want to create a custom class of a CommandBinding, where a RelayCommand of my ViewModel is executed when the RoutedCommand is executed. Currently there is only the possibility to create CommandBindings which have Executed methods in the codebehind…
Henk
  • 750
  • 10
  • 21
2
votes
1 answer

RelayCommand from ViewModel & DispatchTimer

Good afternoon, I'm trying to fire an ICommand in the viewmodel... FROM the viewmodel, instead of from the UI. The command works fine from the UI xaml, however, in this different scenario, it does not. private DispatcherTimer telTimer; public…
Logan Klenner
  • 415
  • 2
  • 7
  • 15
2
votes
1 answer

RelayCommand not executing

I'm trying to execute a RelayCommand (which is in my CodeBehind) using the RelayCommand from Galasoft MVVMLight. MainPage.xaml.cs public MainPage() { InitializeComponent(); DataContext = this; MyCommand = new…
Rudi
  • 926
  • 2
  • 19
  • 38