public void MoveDivider(Tab tabSelect) { foreach (var tab in TabCollection) { if (Equals(tab, tabSelect)) { ActualSelect = tab; tab.Title.Opacity = 1; if (_oldSelection == null) { dt.Stop(); Divider.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(0, Canvas.GetLeft(tab), TimeSpan.FromMilliseconds(150))); Animations.AnimateWidth(Divider.ActualWidth, tab.ActualWidth, Divider, 0.15, 0, () => dt.Start()); } else { dt.Stop(); Divider.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(Canvas.GetLeft(_oldSelection), Canvas.GetLeft(tab), TimeSpan.FromMilliseconds(150))); Animations.AnimateWidth(Divider.ActualWidth, tab.ActualWidth, Divider, 0.15, 0, () => dt.Start()); } } } }
private void Dt_Tick(object sender, EventArgs e) { if (ActualSelect != null) { Divider.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(Canvas.GetLeft(Divider), Canvas.GetLeft(ActualSelect), TimeSpan.FromMilliseconds(1))); Animations.AnimateWidth(Divider.ActualWidth, ActualSelect.ActualWidth, Divider, 0, 0, null); } }