コード例 #1
0
        public static SolidColorBrush SetIdentity(
            [NotNull] this SolidColorBrush @this,
            [CanBeNull] MaterialIdentity materialIdentity)
        {
            @this.IsNotNull(nameof(@this));

            if ((@this.CanFreeze && @this.IsFrozen) || @this.IsSealed)
            {
                //@this.Changed += (s, args) =>
                //{

                //};
                var cloned = @this.Clone();

                cloned.SetValue(
                    MDH.IdentityProperty,
                    materialIdentity);

                cloned.Freeze();

                return(cloned);
            }
            else
            {
                //@this.Changed += (s, args) =>
                //{

                //};

                var existingIdentity = @this.GetIdentity();
                if (existingIdentity != null)
                {
                    if (!existingIdentity.Equals(materialIdentity))
                    {
                    }
                }
                @this.SetValue(
                    MDH.IdentityProperty,
                    materialIdentity);

                if (@this.CanFreeze)
                {
                    @this.Freeze();
                }

                return(@this);
            }
        }