CommandManager.InvalidateRequerySuggested Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
öğesini CommandManager olayı tetiklemeye zorlar RequerySuggested .
public:
static void InvalidateRequerySuggested();
public static void InvalidateRequerySuggested();
static member InvalidateRequerySuggested : unit -> unit
Public Shared Sub InvalidateRequerySuggested ()
Örnekler
Aşağıdaki örnekte, olayı tetiklemeye DispatcherTimer zorlamak InvalidateRequerySuggested için düzenli aralıklarla çağrısı CommandManager yapmak için bir RequerySuggested kullanılır.
// 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
Açıklamalar
Yalnızca CommandManager klavye odağındaki değişiklik gibi komut hedefinin ne zaman değiştiğini belirlerken belirli koşullara dikkat eder. komutunun CommandManager yürütülemediği koşullardaki bir değişikliği yeterince belirlemediği durumlarda, InvalidateRequerySuggested öğesini olayı tetiklemeye CommandManager zorlamak RequerySuggested için çağrılabilir.