private void NavBar_stpanel_MouseEnter(object sender, MouseEventArgs e) { DoubleAnimation an = new DoubleAnimation(); an.From = NavBar.Width; an.To = 100; an.Duration = new Duration(TimeSpan.FromMilliseconds(250)); NavBar.BeginAnimation(WidthProperty, an, HandoffBehavior.SnapshotAndReplace); }
private void NavBar_stpanel_MouseLeave(object sender, MouseEventArgs e) { Trace.WriteLine(e.GetPosition(null).X); if (e.GetPosition(null).X < 20) { return; } DoubleAnimation an = new DoubleAnimation(); an.From = NavBar.ActualWidth; an.To = 0; an.Duration = new Duration(TimeSpan.FromMilliseconds(250)); NavBar.BeginAnimation(WidthProperty, an, HandoffBehavior.SnapshotAndReplace); }