예제 #1
0
        /// <summary>
        ///     Update the current visual state of the button.
        /// </summary>
        /// <param name="useTransitions">
        ///     True to use transitions when updating the visual state, false to
        ///     snap directly to the new visual state.
        /// </param>
        internal virtual void UpdateVisualState(bool useTransitions)
        {
            if (IsLocked)
            {
                VisualStates.GoToState(this, useTransitions, VisualStates.StateLocked);
            }
            else
            {
                VisualStates.GoToState(this, useTransitions, VisualStates.StateUnlocked);
            }

            switch (ExpandDirection)
            {
            case ExpandDirection.Down:
                VisualStates.GoToState(this, useTransitions, VisualStates.StateExpandDown);
                break;

            case ExpandDirection.Up:
                VisualStates.GoToState(this, useTransitions, VisualStates.StateExpandUp);
                break;

            case ExpandDirection.Left:
                VisualStates.GoToState(this, useTransitions, VisualStates.StateExpandLeft);
                break;

            default:
                VisualStates.GoToState(this, useTransitions, VisualStates.StateExpandRight);
                break;
            }

            // let the header know a change has possibly occured.
            if (ExpanderButton != null)
            {
                ExpanderButton.UpdateVisualState(useTransitions);
            }

            // Handle the Common and Focused states
            _interaction.UpdateVisualStateBase(useTransitions);
        }
예제 #2
0
        /// <summary>
        ///     Updates the state of the visual.
        /// </summary>
        /// <param name="useTransitions">If set to <c>true</c> use transitions.</param>
        /// <remarks>The header will follow the parent accordionitem states.</remarks>
        internal virtual void UpdateVisualState(bool useTransitions)
        {
            // the visualstate of the header is completely dependent on the parent state.
            if (ParentAccordionItem == null)
            {
                return;
            }

            if (ParentAccordionItem.IsSelected)
            {
                VisualStates.GoToState(this, useTransitions, VisualStates.StateExpanded);
            }
            else
            {
                VisualStates.GoToState(this, useTransitions, VisualStates.StateCollapsed);
            }

            switch (ParentAccordionItem.ExpandDirection)
            {
            // no animations on an expanddirection change.
            case ExpandDirection.Down:
                VisualStates.GoToState(this, false, VisualStates.StateExpandDown);
                break;

            case ExpandDirection.Up:
                VisualStates.GoToState(this, false, VisualStates.StateExpandUp);
                break;

            case ExpandDirection.Left:
                VisualStates.GoToState(this, false, VisualStates.StateExpandLeft);
                break;

            default:
                VisualStates.GoToState(this, false, VisualStates.StateExpandRight);
                break;
            }
        }