The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

Custom Events for use with <EVENT TRIGGER> XAML tag RRS feed

  • General discussion

  • Ok ... I am hoping i am missing something easy and somebody can help me here. I am working with a designer who is doing all the UI design in Blend/XAML. We would like to trigger some animations and media playback off some custom events. So in my C# code I want to expose an event that he can call in XAML using the tag. From reading the documentation it looks like it needs to be a routed event. So I added code to support a routed event based on what I read on MSDN, but it looks like some of the required elements are not supported on phone ... like the event manager class. Code I used is below. Does anybody have any idea on how I can expose and event in C# so my designer can trigger off it in XAML. public static readonly RoutedEvent VoiceEvent = EventManager.RegisterRoutedEvent( "Tap", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(VAD)); // Provide CLR accessors for the event public event RoutedEventHandler Tap { add { AddHandler(TapEvent, value); } remove { RemoveHandler(TapEvent, value); } }
    Sunday, December 26, 2010 5:15 PM

All replies

  • Hi,

    Looked like you might have been battling with formating.. you can resolve this by setting the Content Editor to Rich Text in your profile. (ps: turn on Show Signatures while you're there)
    Monday, December 27, 2010 3:58 AM
  • Mick ... thanks for the suggestion but I don't think that is my problem. I did some more searching and it turns out custom RoutedEvents are not supported in Silverlight (and hence the phone). So let me rephrase my question for all and see if I can get some help. I have a custom class that performs the duty of being a VAD (voice activity detector). I want to drive a mediaelement from an event generated by the VAD class. I understand how to do this in code but I really want my designer to be able to build his designs around my events in Script and using blend. So I guess the real question is how to I exposed an event in my CUSTOM VAD class in XAML so it can be used to control a Mediaelement (or any UIElement for that matter)
    Monday, December 27, 2010 5:02 AM