Event trigger, custom
-
I have a UserControl with a custom RoutedEvent. I want to use that to trigger an animation, but can't get it to work at all.
public partial class InfoBox1 : UserControl {
public static readonly RoutedEvent MyFadeOutEvent =
EventManager.RegisterRoutedEvent("MyFadeOut", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(InfoBox1));
public event RoutedEventHandler MyFadeOut
{
add { AddHandler(MyFadeOutEvent, value); }
remove { RemoveHandler(MyFadeOutEvent, value); }
}
void RaiseMyFadeOutEvent()
{
RoutedEventArgs newEventArgs = new RoutedEventArgs(InfoBox1.MyFadeOutEvent);
RaiseEvent(newEventArgs);
} ...<UserControl.Triggers>
<EventTrigger RoutedEvent="InfoBox1.MyFadeOut">...and the error: 'InfoBox1.MyFadeOut' value cannot be assigned to property 'RoutedEvent' of object 'System.Windows.EventTrigger'. Value cannot be null. What am I doing wrong here? :confused:
-
I have a UserControl with a custom RoutedEvent. I want to use that to trigger an animation, but can't get it to work at all.
public partial class InfoBox1 : UserControl {
public static readonly RoutedEvent MyFadeOutEvent =
EventManager.RegisterRoutedEvent("MyFadeOut", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(InfoBox1));
public event RoutedEventHandler MyFadeOut
{
add { AddHandler(MyFadeOutEvent, value); }
remove { RemoveHandler(MyFadeOutEvent, value); }
}
void RaiseMyFadeOutEvent()
{
RoutedEventArgs newEventArgs = new RoutedEventArgs(InfoBox1.MyFadeOutEvent);
RaiseEvent(newEventArgs);
} ...<UserControl.Triggers>
<EventTrigger RoutedEvent="InfoBox1.MyFadeOut">...and the error: 'InfoBox1.MyFadeOut' value cannot be assigned to property 'RoutedEvent' of object 'System.Windows.EventTrigger'. Value cannot be null. What am I doing wrong here? :confused:
-
When you solve a question you're asking, don't reply to your own message. Instead, edit the message, and change the title to include "[SOLVED]" at the end, and in your original message, describe what you did to solve it.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
When you solve a question you're asking, don't reply to your own message. Instead, edit the message, and change the title to include "[SOLVED]" at the end, and in your original message, describe what you did to solve it.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001That should be added to THE Guidelines[^]. That reminds me, why don't we have THE guidelines[^] pinned up here?