CommandManager.InvalidateRequerySuggested 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
CommandManager 이벤트를 발생 RequerySuggested 하도록 합니다.
public:
static void InvalidateRequerySuggested();
public static void InvalidateRequerySuggested();
static member InvalidateRequerySuggested : unit -> unit
Public Shared Sub InvalidateRequerySuggested ()
예제
다음 예제에서는 주기적으로 호출 DispatcherTimer 을 사용하여 InvalidateRequerySuggested 이벤트를 발생 CommandManager 하도록 강제 RequerySuggested 합니다.
// 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 void dispatcherTimer_Tick(object sender, EventArgs e)
{
// Updating the Label which displays the current second
lblSeconds.Content = DateTime.Now.Second;
// Forcing the CommandManager to raise the RequerySuggested event
CommandManager.InvalidateRequerySuggested();
}
' 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
설명
CommandManager 키보드 포커스의 변경과 같이 명령 대상이 변경된 시기를 결정하는 특정 조건에만 주의합니다. 명령이 CommandManager 실행 InvalidateRequerySuggested 되지 않는 조건의 변경을 충분히 결정하지 못하는 경우에는 강제로 이벤트를 발생 CommandManager 하도록 RequerySuggested 호출할 수 있습니다.