GetVisualStateGroup() private static method

Gets a named VisualStateGroup for a framework element.
private static GetVisualStateGroup ( FrameworkElement element, string groupName ) : System.Windows.VisualStateGroup
element System.Windows.FrameworkElement
groupName string
return System.Windows.VisualStateGroup
        /// <summary>
        /// Updates the drop-indicator height value for visual state and transition animations.
        /// </summary>
        /// <remarks>
        /// This is a workaround for the inability of visual states and transitions to do template binding
        /// in Silverlight 3. In SL4, they could bind directly to the DropIndicatorHeight property instead.
        /// </remarks>
        protected void OnDropIndicatorHeightChanged(DependencyPropertyChangedEventArgs e)
        {
            Panel            rootPanel = (Panel)VisualTreeHelper.GetChild(this, 0);
            VisualStateGroup vsg       = ReorderListBoxItem.GetVisualStateGroup(
                rootPanel, ReorderListBoxItem.DropIndicatorStateGroup);

            if (vsg != null)
            {
                foreach (VisualState vs in vsg.States)
                {
                    foreach (Timeline animation in vs.Storyboard.Children)
                    {
                        this.UpdateDropIndicatorAnimationHeight((double)e.NewValue, animation);
                    }
                }
                foreach (VisualTransition vt in vsg.Transitions)
                {
                    foreach (Timeline animation in vt.Storyboard.Children)
                    {
                        this.UpdateDropIndicatorAnimationHeight((double)e.NewValue, animation);
                    }
                }
            }
        }