/// <summary> /// The animated expender_ expanded. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void AnimatedExpenderExpanded(object sender, RoutedEventArgs e) { Expander ex = sender as Expander; if (ex != null && ex.Parent.GetType().Name == typeof(WrapPanel).Name) { WrapPanel wr = ex.Parent as WrapPanel; if (wr != null) { foreach (var exP in wr.Children) { Expander wEx = exP as Expander; if (wEx != null && (!wEx.Equals(ex) && wEx.IsExpanded)) { wEx.IsExpanded = false; } } if (wr.Equals(this.WpServers)) { if (this.ExSelf.IsExpanded) { this.ExUsernameAndPass.IsEnabled = false; if (!this.ExOpen.IsExpanded) { this.ExOpen.IsExpanded = true; } } else if (this.ExServer.IsExpanded) { this.ExUsernameAndPass.IsEnabled = true; } else if (this.ExWeb.IsExpanded) { this.ExUsernameAndPass.IsEnabled = true; } else if (this.ExProxy.IsExpanded) { this.ExUsernameAndPass.IsEnabled = true; } } } } if (ex == null || ex.Content == null) { return; } DoubleAnimation animation = new DoubleAnimation( 25, ((Grid)ex.Content).Height + 25, new Duration(TimeSpan.FromSeconds(0.4))); ex.BeginAnimation(HeightProperty, animation); this.SaveSettings(); }
/// <summary> /// The animated expender_ collapsed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void AnimatedExpenderCollapsed(object sender, RoutedEventArgs e) { Expander ex = sender as Expander; if (ex != null && ex.Parent.GetType().Name == typeof(WrapPanel).Name) { WrapPanel wr = ex.Parent as WrapPanel; bool onIsEnable = false; if (wr != null) { foreach (var exP in wr.Children) { Expander wEx = exP as Expander; if (wEx != null && (!wEx.Equals(ex) && wEx.IsExpanded)) { onIsEnable = true; } } } if (!onIsEnable) { ex.IsExpanded = true; return; } } if (ex == null || ex.Content == null) { return; } DoubleAnimation animation = new DoubleAnimation( ((Grid)ex.Content).Height + 25, 25, new Duration(TimeSpan.FromSeconds(0.2))); ex.BeginAnimation(HeightProperty, animation); }