CommandManager.InvalidateRequerySuggested 메서드

정의

CommandManagerRequerySuggested 이벤트를 발생시키도록 합니다.

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 이벤트.

적용 대상