コード例 #1
0
        public bool SetProperty(ResolvedPropertySetter value, bool replace, out string error)
        {
            error = null;
            ResolvedPropertySetter oldValue;

            if (!Properties.TryGetValue(value.Property, out oldValue) || replace)
            {
                Properties[value.Property] = value;
            }
            else
            {
                if (!value.Property.MarkupOptions.AllowValueMerging)
                {
                    error = $"Property '{value.Property}' is already set and it's value can't be merged.";
                }
                var merger      = (IAttributeValueMerger)Activator.CreateInstance(value.Property.MarkupOptions.AttributeValueMerger);
                var mergedValue = (ResolvedPropertySetter)merger.MergeValues(oldValue, value, out error);
                if (error != null)
                {
                    error = $"Could not merge values using {value.Property.MarkupOptions.AttributeValueMerger.Name}: {error}";
                    return(false);
                }
                Properties[mergedValue.Property] = mergedValue;
            }
            value.Parent = this;
            return(true);
        }
コード例 #2
0
        public void SetProperty(ResolvedPropertySetter value, bool replace = false)
        {
            string error;

            if (!SetProperty(value, replace, out error))
            {
                throw new Exception(error);
            }
        }
コード例 #3
0
ファイル: ResolvedControl.cs プロジェクト: darilek/dotvvm
 public void SetProperty(ResolvedPropertySetter value)
 {
     Properties[value.Property] = value;
     value.Parent = this;
 }
コード例 #4
0
 public void SetProperty(ResolvedPropertySetter value)
 {
     Properties[value.Property] = value;
     value.Parent = this;
 }