title: why the animation of previous selected tabitem and selected tabitem started working fine, then it didn't work fine?
body: <p>The animation of previous selected tabitem and selected tabitem started working fine, then it didn't work fine.</p>
  <p>It seems to me that the code should work correctly. I don't know why the animation is not correct now.</p>
  <p>MainWindow.xaml:</p>
  <pre><code>&lt;Window.Resources&gt;
          &lt;local:TestViewModel x:Key=&quot;vm&quot;/&gt;
          &lt;Style TargetType=&quot;{x:Type Rectangle}&quot;&gt;
              &lt;Setter Property=&quot;Visibility&quot; Value=&quot;Visible&quot;/&gt;
              &lt;Setter Property=&quot;IsEnabled&quot; Value=&quot;True&quot;/&gt;
              &lt;Style.Triggers&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;0&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;1&quot;/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard1&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;0&quot; To=&quot;40&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;0&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;2&quot;/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard3&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;0&quot; To=&quot;75&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;0&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;3&quot;/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard5&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;0&quot; To=&quot;115&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;1&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;0&quot;/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard11&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;40&quot; To=&quot;0&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;1&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;2&quot;/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard7&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;40&quot; To=&quot;75&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;1&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;3&quot;/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard9&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;40&quot; To=&quot;115&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;2&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;0&quot;/&gt;
  
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard13&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;70&quot; To=&quot;0&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;2&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;1&quot;/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard15&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;70&quot; To=&quot;40&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                  &lt;MultiDataTrigger&gt;
                      &lt;MultiDataTrigger.Conditions&gt;
                          &lt;Condition Binding=&quot;{Binding  PreviousSelected }&quot; Value=&quot;2&quot;/&gt;
                          &lt;Condition Binding=&quot;{Binding ElementName=TestTabs, Path=SelectedIndex}&quot; Value=&quot;3&quot;/&gt;
                      &lt;/MultiDataTrigger.Conditions&gt;
                      &lt;MultiDataTrigger.EnterActions&gt;
                          &lt;BeginStoryboard Name=&quot;MyBeginStoryboard17&quot;&gt;
                              &lt;Storyboard&gt;
                                  &lt;DoubleAnimation Storyboard.TargetProperty=&quot;(Canvas.Left)&quot; From=&quot;70&quot; To=&quot;115&quot; Duration=&quot;0:0:0.2&quot;&gt;&lt;/DoubleAnimation&gt;
                              &lt;/Storyboard&gt;
                          &lt;/BeginStoryboard&gt;
                      &lt;/MultiDataTrigger.EnterActions&gt;
                  &lt;/MultiDataTrigger&gt;
                 
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
      &lt;/Window.Resources&gt;
      &lt;Grid  DataContext=&quot;{StaticResource vm}&quot; &gt;
          &lt;Grid.RowDefinitions&gt;
              &lt;RowDefinition Height=&quot;*&quot;/&gt;
              &lt;RowDefinition Height=&quot;50&quot;/&gt;
          &lt;/Grid.RowDefinitions&gt;
          &lt;TabControl     SelectedIndex=&quot;{Binding Selected,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}&quot;     Grid.Row=&quot;0&quot;   x:Name=&quot;TestTabs&quot;&gt;
              &lt;TabItem Name=&quot;Tab1&quot; Header=&quot;News&quot; /&gt;
              &lt;TabItem Name=&quot;Tab2&quot; Header=&quot;DLC&quot; /&gt;
              &lt;TabItem Name=&quot;Tab3&quot; Header=&quot;Settings&quot;/&gt;
          &lt;/TabControl&gt;
          &lt;DockPanel  x:Name=&quot;rp&quot; Grid.Row=&quot;0&quot; LastChildFill=&quot;False&quot; HorizontalAlignment=&quot;Stretch&quot;&gt;
              &lt;Canvas DockPanel.Dock=&quot;Left&quot; &gt;
                  &lt;Rectangle x:Name=&quot;Rect1&quot; Fill=&quot;#ff0000&quot; VerticalAlignment=&quot;Top&quot;  Height=&quot;4&quot; Margin=&quot;0,25,0,0&quot; 
                             SnapsToDevicePixels=&quot;True&quot; UseLayoutRounding=&quot;True&quot; RenderOptions.EdgeMode=&quot;Aliased&quot; 
                             Width=&quot;{Binding ElementName=TestTabs, Path=SelectedItem.ActualWidth}&quot;  RenderOptions.BitmapScalingMode=&quot;HighQuality&quot; /&gt;
              &lt;/Canvas&gt;
          &lt;/DockPanel&gt;
          &lt;StackPanel Orientation=&quot;Horizontal&quot; Grid.Row=&quot;1&quot;&gt;
              &lt;Label Content=&quot;selected&quot; Width=&quot;100&quot; Height=&quot;40&quot; /&gt;
              &lt;TextBox x:Name=&quot;sele&quot; Text=&quot;{Binding Selected}&quot; Width=&quot;100&quot; Height=&quot;40&quot; Background=&quot;AliceBlue&quot; Margin=&quot;5&quot;/&gt;
              &lt;Label Content=&quot;previousSelected&quot;  Width=&quot;100&quot; Height=&quot;40&quot;/&gt;
              &lt;TextBox x:Name=&quot;prev&quot; Text=&quot;{Binding PreviousSelected,Mode=OneWay}&quot; Width=&quot;100&quot; Height=&quot;40&quot; Background=&quot;AliceBlue&quot; Margin=&quot;5&quot;/&gt;
          &lt;/StackPanel&gt;
      &lt;/Grid&gt;
  </code></pre>
  <p>MainWindow.xaml.cs:</p>
  <pre><code>using System.ComponentModel;
  using System.Windows;
  namespace TabControlBindSlide
  {
    public partial class MainWindow : Window
    {
      public MainWindow()
      {
        InitializeComponent();
      }
    }
    class TestViewModel : INotifyPropertyChanged
    {
      private int _selected;
      public int Selected
      {
        get { return _selected; }
        set
        {
          int temp = _selected;
          _selected = value;
          _previousSelected = temp;
          NotifyPropertyChanged(&quot;Selected&quot;, temp, value);
          NotifyPropertyChanged(&quot;PreviousSelected&quot;, temp, temp);
        }
      }
      int _previousSelected = 0;
      public int PreviousSelected
      {
        get { return _previousSelected; }
      }
      public event PropertyChangedEventHandler PropertyChanged;
      protected void NotifyPropertyChanged&lt;T&gt;(string propertyName, T oldvalue, T newvalue)
      {
        OnPropertyChanged(this, new PropertyChangedExtendedEventArgs&lt;T&gt;(propertyName, oldvalue, newvalue));
      }
      public virtual void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
      {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
          handler(sender, e);
      }
    }
    public class PropertyChangedExtendedEventArgs&lt;T&gt; : PropertyChangedEventArgs
    {
      public virtual T OldValue { get; private set; }
      public virtual T NewValue { get; private set; }
  
      public PropertyChangedExtendedEventArgs(string propertyName, T oldValue, T newValue)
          : base(propertyName)
      {
        OldValue = oldValue;
        NewValue = newValue;
      }
    }
  
  }
  </code></pre>
  <p>The result:
  The animation starts working fine, then it doesn't work.</p>
  <p><a href="https://i.stack.imgur.com/1Z5ST.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Z5ST.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/vgHO0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vgHO0.png" alt="enter image description here" /></a></p>