示例#1
0
 /// <summary>
 /// Gets the <see cref="VisualStateTransitionKey"/> which corresponds to the specified transition, if the appropriate
 /// visual states and transitions are defined within this group.
 /// </summary>
 /// <param name="from">The visual state which is being transitioned from.</param>
 /// <param name="to">The visual state which is being transitioned to.</param>
 /// <param name="key">The visual state transition key which was created.</param>
 /// <param name="transitionMustExist">A value indicating whether the specifiied transition must exist in order for a key to be created.</param>
 /// <returns><see langword="true"/> if the visual state transition key was created; otherwise, <see langword="false"/>.</returns>
 private Boolean GetVisualStateTransitionKey(VisualState from, VisualState to, out VisualStateTransitionKey key, Boolean transitionMustExist)
 {
     key = new VisualStateTransitionKey(from, to);
     if (transitionMustExist && !transitions.ContainsKey(key))
     {
         key = new VisualStateTransitionKey(null, to);
         if (transitionMustExist && !transitions.ContainsKey(key))
         {
             key = default(VisualStateTransitionKey);
             return(false);
         }
     }
     return(true);
 }
示例#2
0
        /// <summary>
        /// Gets the <see cref="VisualStateTransitionKey"/> which corresponds to the specified transition, if the appropriate
        /// visual states and transitions are defined within this group.
        /// </summary>
        /// <param name="from">The visual state which is being transitioned from.</param>
        /// <param name="to">The visual state which is being transitioned to.</param>
        /// <param name="key">The visual state transition key which was created.</param>
        /// <param name="transitionMustExist">A value indicating whether the specifiied transition must exist in order for a key to be created.</param>
        /// <returns><see langword="true"/> if the visual state transition key was created; otherwise, <see langword="false"/>.</returns>
        private Boolean GetVisualStateTransitionKey(String from, String to, out VisualStateTransitionKey key, Boolean transitionMustExist)
        {
            var vsFrom = (VisualState)null;

            if (from != null)
            {
                vsFrom = Get(from);
                if (vsFrom == null)
                {
                    key = default(VisualStateTransitionKey);
                    return(false);
                }
            }

            var vsTo = Get(to);

            if (vsTo == null)
            {
                key = default(VisualStateTransitionKey);
                return(false);
            }

            return(GetVisualStateTransitionKey(vsFrom, vsTo, out key, transitionMustExist));
        }