Microsoft.Phone.Controls.ContextMenu.UpdateVisualStates C# (CSharp) Method

UpdateVisualStates() private method

Uses VisualStateManager to go to the appropriate visual state.
private UpdateVisualStates ( bool useTransitions ) : void
useTransitions bool true to use a System.Windows.VisualTransition to /// transition between states; otherwise, false.
return void
        private void UpdateVisualStates(bool useTransitions)
        {
            string stateName;

            if (IsOpen)
            {
                if (null != _openingStoryboard)
                {
                    _openingStoryboardPlaying = true;
                    _openingStoryboardReleaseThreshold = DateTime.UtcNow.AddSeconds(0.3);
                }

                if (_rootVisual != null && _rootVisual.Orientation.IsPortrait())
                {
                    if (_outerPanel != null)
                    {
                        _outerPanel.Orientation = Orientation.Vertical;
                    }

                    stateName = _reversed ? OpenReversedVisibilityStateName : OpenVisibilityStateName;
                }
                else
                {
                    if (_outerPanel != null)
                    {
                        _outerPanel.Orientation = Orientation.Horizontal;
                    }

                    stateName = _reversed ? OpenLandscapeReversedVisibilityStateName : OpenLandscapeVisibilityStateName;
                }

                if (null != _backgroundResizeStoryboard)
                {
                    _backgroundResizeStoryboard.Begin();
                }
            }
            else
            {
                stateName = ClosedVisibilityStateName;
            }

            VisualStateManager.GoToState(this, stateName, useTransitions);
        }