Frage

I have TextBlock I have declared it in Xaml with its Tapped event.Now i wanted to raise this event manually from code without actually Tap on it from external input.

 private void TxtBlkMessages_Tapped_1(object sender, TappedRoutedEventArgs e)
 {
  // want to raise it manually
  // some storyboards animation is present in it
 }

I have defined it in xaml like this..

<TextBlock Name="TxtBlkMessages"  Tapped="TxtBlkMessages_Tapped_1" />

More precisely i want to raise it from viewmodel on basis of some condition.

War es hilfreich?

Lösung

If you want it to raise manually then simply u can call the method

Example :

private void CallManually()
{    
    TxtBlkMessages_Tapped_1(null, null);
}

Andere Tipps

Just call:

TxtBlkMessages.RaiseEvent(new TappedRoutedEventArgs());
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top