コード例 #1
0
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            var mode = value.ToBorderRepeat();

            if (mode != null)
            {
                _horizontal = _vertical = mode.Value;
            }
            else if (value is CSSValueList)
            {
                var          list       = (CSSValueList)value;
                BorderRepeat?horizontal = null;
                BorderRepeat?vertical   = null;

                if (list.Length > 2)
                {
                    return(false);
                }

                foreach (var entry in list)
                {
                    mode = entry.ToBorderRepeat();

                    if (mode == null)
                    {
                        return(false);
                    }
                    else if (horizontal == null)
                    {
                        horizontal = mode;
                    }
                    else
                    {
                        vertical = mode;
                    }
                }

                _horizontal = horizontal.Value;
                _vertical   = vertical.Value;
            }
            else
            {
                return(false);
            }

            return(true);
        }