public bool IsExplicitlyInherited(IStyleKey key)
        {
            if (!StyleSystem.IsRegisteredKey(key))
            {
                throw new ArgumentException($"StyleKey {key} is not registered here.");
            }

            var index = StyleSystem.LinearIndexFor(key);

            return(InheritMarker.IsInheritMarker(values[index]));
        }
        public bool SetValue(IStyleKey key, object value)
        {
            var idx = StyleSystem.LinearIndexFor(key);

            cachedValues[idx] = null;
            if (elementStyle.SetValue(key, value))
            {
                if (key.Inherit || InheritMarker.IsInheritMarker(value))
                {
                    // inherited styles are distributed to child elements, so we need to explicitly clear them all.
                    self.InvalidateStyle(false);
                }

                self.InvalidateLayout();
                return(true);
            }
            return(false);
        }
        public bool SetValue(IStyleKey key, object value)
        {
            if (!StyleSystem.IsRegisteredKey(key))
            {
                throw new ArgumentException();
            }

            if (!InheritMarker.IsInheritMarker(value) && value != null && !key.ValueType.IsInstanceOfType(value))
            {
                throw new ArgumentException();
            }

            var index   = StyleSystem.LinearIndexFor(key);
            var changed = !Equals(values[index], value);

            if (changed)
            {
                values[index] = value;
            }
            keys[index]          = key;
            valuesTouched[index] = true;
            return(changed);
        }
        public bool SetValue(IStyleKey key, object value)
        {
            if (!StyleSystem.IsRegisteredKey(key))
            {
                throw new ArgumentException();
            }

            if (!InheritMarker.IsInheritMarker(value) && value != null && !key.ValueType.IsInstanceOfType(value))
            {
                throw new ArgumentException();
            }

            var index   = StyleSystem.LinearIndexFor(key);
            var changed = !Equals(values[index], value);

            values[index] = value;

            if (changed)
            {
                ValueChanged?.Invoke(this, new StyleEventArgs(key));
            }
            return(changed);
        }