public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args) { base.TraceEvent(eventCache, source, eventType, id, format, args); if (format.StartsWith("Storyboard has begun;")) { TriggerTraceStoryboard storyboard = args[1] as TriggerTraceStoryboard; if (storyboard != null) { // add a breakpoint here to see when your trigger has been // entered or exited // the element being acted upon object targetElement = args[5]; TriggerBase triggerBase = storyboard.TriggerBase; string triggerName = GetTriggerName(storyboard.TriggerBase); Debug.WriteLine(string.Format("Element: {0}, {1}: {2}: {3}", targetElement, triggerBase.GetType().Name, triggerName, storyboard.StoryboardType)); } } }
public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args) { base.TraceEvent(eventCache, source, eventType, id, format, args); if (format.StartsWith("Storyboard has begun;", StringComparison.Ordinal)) { TriggerTraceStoryboard storyboard = args[1] as TriggerTraceStoryboard; if (storyboard != null) { // add a breakpoint here to see when your trigger has been entered or exited // the element being acted upon object targetElement = args[5]; // the namescope of the element being acted upon INameScope namescope = (INameScope)args[7]; TriggerBase triggerBase = storyboard.TriggerBase; string triggerName = GetTriggerName(storyboard.TriggerBase); Debug.WriteLine( $"Element: {targetElement}, {triggerBase.GetType().Name}: {triggerName}: {storyboard.StoryboardType}"); } } }