Assembly: PresentationCore (in PresentationCore.dll)
The CommandManager only pays attention to certain conditions in determining when the command target has changed, such as change in keyboard focus. In situations where the CommandManager does not sufficiently determine a change in conditions that cause a command to not be able to execute, can be called to force the CommandManager to raise the RequerySuggested event.
' System.Windows.Threading.DispatcherTimer.Tick handler ' ' Updates the current seconds display and calls ' InvalidateRequerySuggested on the CommandManager to force ' the Command to raise the CanExecuteChanged event. Private Sub dispatcherTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) ' Updating the Label which displays the current second lblSeconds.Content = Date.Now.Second ' Forcing the CommandManager to raise the RequerySuggested event CommandManager.InvalidateRequerySuggested() End Sub