Questions tagged [canexecute]

66 questions
21
votes
3 answers

What is CanExecuteChanged for?

Can I use CanExecuteChanged to change the "can execute" condition? Or else... "for what" its used?
Relativity
  • 6,690
  • 22
  • 78
  • 128
13
votes
1 answer

Jenkins failed unit CanExecute test's methods nondeterministic

We have a lot CanExecute tests for a various commands in our project. All tests passed properly when we use Visual Studio testing or AxoCover. We tried to add some previous object initialization, before executing 'CanExecute' and sometimes it worked…
11
votes
1 answer

How to use the CanExecute Method from ICommand on WPF

How does one use the CanExecute Method from the ICommand interface? In my example i have a SaveCommand which i only what to be enable when the object is saveable. The XAML Code of my Savebutton looks like this:
9
votes
4 answers

MVVM RelayCommand CanExecute

I'm implementing an RelayCommand with an execute and an canExecute part. The RelayCommand works when it is without the canExecute part, however when I add the canExecute part, the command locks the button. The RelayCommand only checks whether or not…
JonasN89
  • 1,386
  • 2
  • 11
  • 23
7
votes
2 answers

CanExecute and CanExecuteChanged, I must implement these with a RelayCommand?

I am using MVVM-Light and i have my relay command working perfectly, I have just read that i should be implementing CanExecuteChanged and CanExecute. Although i am unable to find a good example. Does anyone have a good example of how to implement…
Martin
  • 23,844
  • 55
  • 201
  • 327
4
votes
1 answer

Performance penalty of continuous CanExecute calls in Command

I am applying the MVVM pattern to a project. I have a UserControl that has a button which is bound to a command exposed by the ViewModel. Since the button is visible, it's calling continuously the CanExecute method of the button. Something tells me…
SoManyGoblins
  • 5,605
  • 8
  • 45
  • 65
4
votes
1 answer

ICommand doesn't update the IsEnabled on a button using CanExecute

I have a very simple button binded to a command My command code public ICommand SaveCommand { get; internal set; } private…
user412045
4
votes
3 answers

Bind Visibility to ReactiveCommand CanExecute

I have several Tiles (TileLayoutControl Class) in my xaml (only shown 2 in this example) whose Visibility are binded to Boolean Properties and converted through BooleanToVisibilityConverter. This works just fine. My question is Can I bind the…
Butters
  • 947
  • 5
  • 16
  • 25
3
votes
1 answer

WPF MVVM Command CanExecute, reevaluates only at focus change

Refactoring an MVVM project in WPF, I'm trying to get rid of what seems a common problem between MVVM pattern users. I have view, who's DataContext is MyViewModel. Here is a button, bound with a Command that implements both Execute and…
Riccardo
  • 31
  • 4
3
votes
1 answer

MVVM Light canExecute always false with RelayCommand not RelayCommand
Do anyone know why being specific with the MVVM Light RelayCommand generic type would cause its canExecute to always resolve to false for the binding? In order to get the correct behavior I had to use an object and then convert it to the desired…
Rock
  • 182
  • 11
3
votes
1 answer

Eclipse Luna: Handlers' @CanExecute methods not called

I'm having a problem with command handlers in Eclipse Luna RCP. In my E4 application model, I defined some commands and related handlers that must be enabled only under certain circumstances. For this reason, in my handler POJOs, I…
l.moretto
  • 193
  • 1
  • 13
3
votes
1 answer

WPF button command binding refreshed, but button still disabled

I have a weird problem with a button's Command binding not being updated... I have an app written with MvvmLight, that allows users to maintain a list of medical systems. These systems are built from templates (ie a template might specify two…
Avrohom Yisroel
  • 8,555
  • 8
  • 50
  • 106
3
votes
1 answer

Using VS2010 online template "WPF MVVM project template", CanExecuteChanged not working?

I created a new WPF MVVM application via Online Templates->WPF in VS2010->WPF MVVM project template. I created a checkbox labeled "Refresh Enabled?" next to the "Refresh" button that I wanted to enable/disable the "Refresh" button when clicked. I…
2
votes
1 answer

WPF UserControl and ICommand

I have created a UserControl which has a button inside and also a style for the button. The style sets the button background upon a mouse over trigger. Now i've added an dependency property of type ICommand and sets the button command to this new…
sysboard
  • 287
  • 7
  • 19
2
votes
3 answers

Using an OleDbDataAdapter on a background thread causes my UI to not update correctly?

I have an app where users can select an Excel file, that excel file is read using an OleDbDataAdapter on another thread, and once it is finished being read it updates the CanExecute property of a Command in my ViewModel to true so the Save button is…
Rachel
  • 130,264
  • 66
  • 304
  • 490
1
2 3 4 5