Questions tagged [relaycommand]

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

289 questions
0
votes
1 answer

MVVM light - Passing multiple parameters in RelayCommand from XAML

I have more than one PasswordBox on my view and I want to pass all their SecureStrings to my view model when I click a button. My guess is that I want to populate an instance of a custom class with all the SecureStrings and pass that object as a…
0
votes
1 answer

Why isn't RelayCommand called?

I have the following in my ViewModel: public MyViewModel() { CloseCommend = new RelayCommand(closeWindow); } public RelayCommand CloseCommend; private void closeWindow() { Application.Current.MainWindow.Close(); } XAML:
0
votes
1 answer

Implementing BtnSquareCommand/RelayCommand

I'm trying to implement a method that makes it possible to change a square figure to a circle. When I run now there's a square that can be moved around. Anyway, how should Implement the command for the square button? namespace Square { public…
ada dudu
  • 49
  • 1
  • 2
  • 8
0
votes
1 answer

Why does async method block MVVM Light Relay Command

I'm new to async and need to consume an API that has it. I've read I should "go async all the way" back the UI command. So far I've propagated async back to my view model. The code below blocks the Upload button in my UI. Is this because the…
Jim C
  • 4,517
  • 7
  • 29
  • 33
0
votes
2 answers

Dynamically assigning a parameter to a RelayCommand in MVVM Light

I've seen quite a few example of passing a parameter through a command using the RelayCommand class in MVVM Light, but there's one slight difference between what i want and what i have seen. I want to create a few buttons where all have them have a…
Luis Ferreira
  • 121
  • 11
0
votes
1 answer

CanExecute not raised when context menu opens

I know there are a handful of related questions but none of those helped me finding the issue. Most answers suggest to implement CanExecuteChanged as shown in this answer. Well, that's not the solution to my problem. I've got an implementation of…
Em1
  • 1,077
  • 18
  • 38
0
votes
2 answers

MVVM Light RelayCommand not working

I am new to using Commands and was trying the CanExecute to enable and disable my buttons depending on some factors. But I am doing something wrong and cant figure it out. When loading it works fine. The CanExecuteGenerate Function gets hit, the…
user1702369
  • 1,089
  • 2
  • 13
  • 31
0
votes
2 answers

C# ICommand / RelayCommand

I recently started learning WPF (with MVVM pattern). I have got a question about ICommand implementation... private ICommand _confirmOptionCommand; public ICommand ConfirmOptionCommand { get { if (_confirmOptionCommand == null) { …
xitryuga
  • 323
  • 1
  • 2
  • 9
0
votes
2 answers

RelayCommand not getting the right Model

I created a user control that looks like a tile. Created another user control named TilePanel that serves as the default container of the tiles. And lastly, the very UI that looks like a Window start screen. I used RelayCommand to bind my…
Jack Frost
  • 318
  • 4
  • 13
0
votes
1 answer

TabControl with Closable TabItem Header

I'm trying to create TabItem Headers with Buttons that enable the User to close tabs. The visual representation and the Databinding of the object is just fine. I've experimented with the DataContext, but so far I haven't found a workable…
Fang
  • 2,199
  • 4
  • 23
  • 44
0
votes
2 answers

RelayCommand for updating a TextBox

I'm new to WPF and especially Commands, and I have task right now to build a RelayCommand for a button. I'm supposed to learn that I need to separate the logic from the UI. I just have 2 textboxes and a textBlock, the user writes the names in the…
tweedledum11
  • 121
  • 9
0
votes
1 answer

Cast Error occured in WFP DataGrid CurrentCellChanged While on Binding a RelayCommand

Inner Exception Message: Unable to cast object of type 'System.Reflection.RuntimeEventInfo' to type 'System.Reflection.MethodInfo'
B.Balamanigandan
  • 4,713
  • 11
  • 68
  • 130
0
votes
1 answer

windows phone 8 - memory leak causing interactivity commands

In Windows Phone 8 application I have ItemsControl with ItemTemplate which have event on tap:
darson1991
  • 406
  • 6
  • 18
0
votes
1 answer

8 Channel RS232 relay board from china

So I purchased this device from a company in china thinking, I'm savvy, I'll be able to figure it…
0
votes
1 answer

XAML - MenuFlyoutItem attached to a ListView doesn't work in WP8.1

I develop an Universal app that uses the MVVM-Lght toolkit. On a page, I show a list of comments. I would like that an user could add a new comment, and edit or delete its existing comments. For adding new comment, I use an AppBarButton on the…
Gold.strike
  • 1,269
  • 13
  • 47