title: WPF Custom Control EventTrigger Not Firing Or Animation Not Working
body: <p><br />
  I am having a go at creating a custom control( its just a custom grid deriving from Grid, I would like to keep it a Grid because of a few other things I want to try), my question is why doesn't the story board work when I am trying to trigger it from an EventTrigger, but works fine under a normal trigger my code is below:</p>
  
  <pre><code>&lt;Style TargetType="{x:Type local:GridEx}"&gt;
      &lt;Setter Property="Width" Value="100" /&gt;
      &lt;Setter Property="Height" Value="100" /&gt;
  
      &lt;Style.Triggers&gt;
          &lt;EventTrigger RoutedEvent="MouseRightButtonDown"&gt;
              &lt;BeginStoryboard&gt;
                  &lt;Storyboard &gt;
                      &lt;DoubleAnimation Storyboard.TargetProperty="Width" To="300" Duration="0:0:1" FillBehavior="HoldEnd" /&gt;
                      &lt;DoubleAnimation Storyboard.TargetProperty="Height" To="300" Duration="0:0:1" FillBehavior="HoldEnd" /&gt;
                  &lt;/Storyboard&gt;
              &lt;/BeginStoryboard&gt;
          &lt;/EventTrigger&gt;
          &lt;Trigger Property="IsMouseOver" Value="True" &gt;
              &lt;!--&lt;Trigger.EnterActions&gt;
                  &lt;BeginStoryboard&gt;
                      &lt;Storyboard &gt;
                          &lt;DoubleAnimation Storyboard.TargetProperty="Width" To="300" Duration="0:0:1" FillBehavior="HoldEnd" /&gt;
                          &lt;DoubleAnimation Storyboard.TargetProperty="Height" To="300" Duration="0:0:1" FillBehavior="HoldEnd" /&gt;
                      &lt;/Storyboard&gt;
                  &lt;/BeginStoryboard&gt;
              &lt;/Trigger.EnterActions&gt;
              &lt;Trigger.ExitActions&gt;
                  &lt;BeginStoryboard&gt;
                      &lt;Storyboard &gt;
                          &lt;DoubleAnimation Storyboard.TargetProperty="Width" To="100" Duration="0:0:1" FillBehavior="HoldEnd" /&gt;
                          &lt;DoubleAnimation Storyboard.TargetProperty="Height" To="100" Duration="0:0:1" FillBehavior="HoldEnd" /&gt;
                      &lt;/Storyboard&gt;
                  &lt;/BeginStoryboard&gt;
              &lt;/Trigger.ExitActions&gt;--&gt;
              &lt;Setter Property="Effect" Value="{StaticResource LiftEffect}"/&gt;
              &lt;Setter Property="RenderTransform"&gt;
                  &lt;Setter.Value&gt;
                      &lt;TranslateTransform X="-1" Y="-1" /&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
              &lt;Setter Property="Panel.ZIndex" Value="10" /&gt;
          &lt;/Trigger&gt;
      &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>The idea is pretty simple when the user holds down the right mouse button I simply want the grid to grow in size. I know the animation works because if I start from Trigger "IsMouseOver" it works fine, but nothing happens if I hold the mouse down?<br />
  And no its not a commenting issue :P</p>
  
  <p>My Custom Control Derives from Grid.</p>
  
  <p><em>EDIT CODE ADDED</em></p>
  
  <p>using System.Windows;
  using System.Windows.Controls;</p>
  
  <pre><code>namespace WPFCCLIB
  {
  
      public class GridEx : Grid
      {
          public static readonly RoutedEvent LeftMouseDoubleClickEvent = EventManager.RegisterRoutedEvent("LeftMouseDoubleClick",RoutingStrategy.Bubble,typeof(RoutedEventHandler), typeof(GridEx));
  
          public event RoutedEventHandler LeftMouseDoubleClick
          {
              add { AddHandler(LeftMouseDoubleClickEvent, value); }
              remove { RemoveHandler(LeftMouseDoubleClickEvent, value); }
          }
  
          static GridEx()
          {
             DefaultStyleKeyProperty.OverrideMetadata(typeof(GridEx), new FrameworkPropertyMetadata(typeof(GridEx)));
          }
  
          void RaiseLeftMouseDoubleClickEvent()
          {
              RoutedEventArgs newEventArgs = new     RoutedEventArgs(GridEx.LeftMouseDoubleClickEvent);
              RaiseEvent(newEventArgs);
          }    
      }
  }
  </code></pre>