Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. Event trigger, custom

Event trigger, custom

Scheduled Pinned Locked Moved WCF and WF
databasehelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mikla521
    wrote on last edited by
    #1

    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:

    M 1 Reply Last reply
    0
    • M mikla521

      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:

      M Offline
      M Offline
      mikla521
      wrote on last edited by
      #2

      Ok, finally it works :) Was only a namespace issue....

      realJSOPR 1 Reply Last reply
      0
      • M mikla521

        Ok, finally it works :) Was only a namespace issue....

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        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

        A 1 Reply Last reply
        0
        • realJSOPR realJSOP

          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

          A Offline
          A Offline
          ABitSmart
          wrote on last edited by
          #4

          That should be added to THE Guidelines[^]. That reminds me, why don't we have THE guidelines[^] pinned up here?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups