title: WPF triggering different Storyboard for the same Target multiple times
body: <p>Creating a card game and when the game starts, 5 cards are given to a hand. Using the storyboard the card goes from the deck to the hand position 0-4 respectively. There is 5 story, one for each 5 hand position.</p>
  
  <p>The story are being called from a for loop which: </p>
  
  <ul>
  <li>get a new card from the Deck.</li>
  <li>Run the corresponding Story.</li>
  <li>Display the new card (the real one not the one coming from the Deck).</li>
  <li>Reset the card coming from the Deck to its original position.</li>
  </ul>
  
  <p>The problem is only the last story called from the for loop is being played. If I change the loop number of occurrence, the stories are working for all the positions, but always only play the last one called . </p>
  
  <pre><code>&lt;Page.Resources&gt;
  
      &lt;Storyboard x:Name="sDeckToHandPositionOne" TargetName="HandPositionOne"&gt; 
          &lt;DoubleAnimation Storyboard.TargetProperty="(Image.RenderTransform).(TranslateTransform.X)" To="0" Duration="0:0:1"/&gt;
          &lt;DoubleAnimation Storyboard.TargetProperty="(Image.RenderTransform).(TranslateTransform.Y)" To="0" Duration="0:0:1"/&gt;
      &lt;/Storyboard&gt;
  
      &lt;Storyboard x:Name="sDeckToHandOne" TargetName="HandPositionOne"&gt; 
          &lt;DoubleAnimation Storyboard.TargetProperty="(Image.RenderTransform).(TranslateTransform.X)" To="0" Duration="0:0:1"/&gt;
          &lt;DoubleAnimation Storyboard.TargetProperty="(Image.RenderTransform).(TranslateTransform.Y)" To="0" Duration="0:0:1"/&gt;
      &lt;/Storyboard&gt;
  
  &lt;/Page.Resources&gt;
  </code></pre>
  
  <pre><code>RunDeckToHandStory(string target) {
  
      string myStory = "sDeckToHandPositionOne";
      Storyboard story = (Storyboard)UI.Ctrl.Resources[myStory] as Storyboard;
      var moveX = (DoubleAnimation)story.Children[0];
      var moveY = (DoubleAnimation)story.Children[1];
      moveX.To = ImgHandCoordinates[Position][target] - ImgHandCoordinates[DeckOfCards][0];
      moveY.To = ImgHandCoordinates[Position][target] - ImgHandCoordinates[DeckOfCards][1];
      story.Begin();
  
  }
  
  For (i=0; i&lt;5; i++) {
  
      int targetHandPosition = i;
      newCard = GetNewCardFromDeck();
      RunDeckToHandStory(targetHandPosition);
      DisplayNewCard(targetHandPosition, newCard);
      ResetDeckCardPosition();
  
  }
  </code></pre>
  
  <p>note: This is an example, it might contain typo.</p>