File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1- using System . Windows . Input ;
1+ using System . Windows ;
2+ using System . Windows . Input ;
23
34namespace SimpleViewModel . BaseClasses ;
45
@@ -16,6 +17,18 @@ public event EventHandler? CanExecuteChanged
1617 remove => CommandManager . RequerySuggested -= value ;
1718 }
1819
20+ /// <summary>
21+ /// Forces WPF to re-evaluate <see cref="CanExecute"/> for all commands.
22+ /// Safe to call from any thread — marshals to the UI dispatcher if needed.
23+ /// </summary>
24+ public void RaiseCanExecuteChanged ( )
25+ {
26+ if ( Application . Current ? . Dispatcher . CheckAccess ( ) == true )
27+ CommandManager . InvalidateRequerySuggested ( ) ;
28+ else
29+ Application . Current ? . Dispatcher . Invoke ( CommandManager . InvalidateRequerySuggested ) ;
30+ }
31+
1932 /// <summary>
2033 /// Determines whether the command can execute in its current state.
2134 /// </summary>
Original file line number Diff line number Diff line change 99
1010 <GeneratePackageOnBuild >true</GeneratePackageOnBuild >
1111 <PackageId >SimpleViewModel</PackageId >
12- <Version >0.9.8.3 </Version >
12+ <Version >0.9.8.4 </Version >
1313 <Authors >Derek Gooding</Authors >
1414 <Company >Derek Gooding</Company >
1515 <Description >
You can’t perform that action at this time.
0 commit comments