Questions tagged [icommand]

Interface for MVVM scenarios in Silverlight and WPF to bind commands from models to controls (Buttons).

Typically objects implement this interface to enable method calls on the objects through the use of XAML bindings. This is particularly useful in Model-View-ViewModel (MVVM) scenarios, as it allows models to expose commands to which controls such as buttons can be bound to without requiring additional code

481 questions
6
votes
3 answers

What is the recommended way to open a new window using MVVM in WPF

Hello everyone and thanks in advance for your time. I'm currently learning MVVM using WPF for a small Biz App that I'm writing. I have read a lot of articles about the MVVM pattern and found that one of the key areas is to decouple the ViewModel…
Daniel
  • 63
  • 1
  • 5
6
votes
1 answer

Dotfuscator CE Build Error: External type not found System.Windows.Input.ICommand,PresentationCore

I have an application targeting the .NET Framework 4.0. It builds and runs fine but I cannot get it to compile in Dotfuscator CE and they will not support it since it is CE. I am stuck. Dotfuscator CE (v5.0.2500.0) with Visual Studio 2010 SP1. …
Kerfluffel
  • 117
  • 9
6
votes
3 answers

Updated title: Why ICommand.CanExecute is getting called all the time, instead of working like an event?

I am adopting MVVM pattern in WPF and have learned the use of Command. But in my implementation, the delegate I assigned to implement CanExecute is always called. I mean if I put a break point inside the delegate function, it shows that this…
tete
  • 4,859
  • 11
  • 50
  • 81
6
votes
2 answers

MVVM (ICommand) in Silverlight

Please, don't judge strictly if this question was discussed previously or indirectly answered in huge nearby prism and mvvm blogs. In WPF implementation of RelayCommand or DelegateCommand classes there is a such eventhandler /// ///…
Andrey Khataev
  • 1,303
  • 6
  • 20
  • 46
6
votes
2 answers

RelayCommand in C#

I am learning MVVM for C# Silverlight development from http://msdn.microsoft.com/en-us/magazine/dd419663.aspx and I am confused about the RelayCommand class mentioned in the context. The code is: public class RelayCommand : ICommand { #region…
Allan Jiang
  • 11,063
  • 27
  • 104
  • 165
6
votes
2 answers

MVVM Execute Command on ViewModel from other ViewModel

I'm struggling for about 14 days now with a simple task: In database, I have definitions for hardware categories. For example : HDD Internal External Flash This list is in database defined like this: [ID - ParrentID - Name] : 1 - 0 - HDD, 2…
sinkien
  • 289
  • 1
  • 3
  • 11
5
votes
1 answer

RoutedUICommand vs. ICommand in ViewModel & using InputBinding

Basic ICommand interface implementations, such as DelegateCommand, and RelayCommand, are missing the the InputGestures property contained in the RoutedCommand class. This property supports binding to a KeyGesture, and the Text property in the…
George Tsiokos
  • 1,890
  • 21
  • 31
5
votes
4 answers

Naming commands in WPF

Not having english as my primary language, I often question grammar when naming methodes and properties. I use NextCommand as name for my command, NextCommandExecuted for the execution method and CanNextCommand for the status. Does this make…
rozon
  • 2,518
  • 4
  • 23
  • 37
5
votes
2 answers

WPF Interaction triggers in a Style to invoke commands on View Model

Possible Duplicate: How to add a Blend Behavior in a Style Setter when I use an interaction trigger in a style, I am getting the following error, 'triggers is not attachable element of type style'. Any explanation what this error actually means…
skjagini
  • 3,142
  • 5
  • 34
  • 63
5
votes
1 answer

How to deactivate button in Xamarin With ICommand

I got an application which has 2 buttons. First is counting up, second says "set 0" in Xamarin forms. I want the upcountButton do get Gray/Disabled when the value of 512 get hit. here my Code: public ObservableCollection Nummer…
S Kirchner
  • 123
  • 12
5
votes
2 answers

How to call Command from within C# code instead of by binding UI-control to it?

I am working on a C#-WPF-App. When pressing a certain button in a window, a module is loaded. This happens because the Command Property of the button is bound to the LoadModuleCommand in the class "ConfigureViewModel":
5
votes
1 answer

WPF exe running very slow compared to running in Visual studio

I have created an application in WPF using the MVVM pattern. The application is running fine in the Visual Studio debugger, but when I'm running the exe from the debug/release folder, it becomes very slow. Here is my RelayCommand class: public class…
sushmitgos
  • 153
  • 3
  • 13
5
votes
2 answers

WPF Custom ICommand implementation and the CanExecuteChanged event

in my WPF UI, I use RoutedCommands that I refer to in my xaml via the following code: Command="viewModel:MessageListViewModel.DeleteMessagesCommand" I don't like this static link to my ViewModel class,I think this is not as nice as creating a…
Sebastian Edelmeier
  • 4,095
  • 3
  • 39
  • 60
5
votes
1 answer

DataGrid WPF Virtualization and Command CanExecute

I'm working on a WPF application with framework .NET 4.0 I have a problem with a DataGrid : every line got 2 commands : public ICommand MoveUpOrderPipeCommand { get { if (_moveUpOrderPipeCommand == null) { …
Tan
  • 121
  • 6
5
votes
3 answers

How to implement ICommand without parameters

In my project, i'd like to use MVVM (& Commands). I've started learning about commands and implementation of ICommand. I'd like to create implementation of ICommand without parameters. (To trigger loading of data/flushing of data etc. - I don't need…
mishan
  • 1,177
  • 3
  • 19
  • 42