Wpf command canexecute not updating

Posted by / 24-Oct-2017 13:05

When I click my "Start" button (bound to 'Start Command'), the "Save" button is correctly disabled.

The b/g process runs to completion, then Is Running is set to false, but this doesn't trigger the "Save" button to become enabled. (The controls whose property to 'Is Running', but it's frustrating that this particular view refused to play ball. Common sense says it's something specific to this view/VM, but I'm stumped (and I'm not going to post the code here - there's too much of it).

Please give an explaination to this case and if possible, point out some related articles or blogs (I've already read too many articles talking about cut/paste command).

Can Execute does not refresh until a keyboard or mouse click.I'm at a loss as to what's causing it - the view-model isn't doing anything that I haven't done dozens of times already. The first one is a "start" command:- ('Is Running' is a bog-standard property, implementing INotify Property Changed.As well as being used for the "Can Execute" delegate, it's also bound to the Is Enabled property of a few controls in the view to enable/disable them).In the LDPing project, clicking the button starts a background process to run an LDPing. Once the ping is finishes, the button should enable, however, originally it didn’t enable. Although writting WPF application for some time, I'm new to WPF Command.

wpf command canexecute not updating-50wpf command canexecute not updating-24wpf command canexecute not updating-7

So, when button is clicked, command Manager raised the Requery Suggested event and hence executed the Can Execute predicate registered for your command.

One thought on “wpf command canexecute not updating”