// This will transfer information in the _setters collection to PropertyValues array. internal void ProcessSettersCollection(SetterBaseCollection setters) { // Add information in Setters collection to PropertyValues array. if (setters != null) { // Seal Setters setters.Seal(); for (int i = 0; i < setters.Count; i++) { Setter setter = setters[i] as Setter; if (setter != null) { DependencyProperty dp = setter.Property; object value = setter.ValueInternal; string target = setter.TargetName; if (target == null) { ProcessParametersContainer(dp); target = StyleHelper.SelfName; } else { target = ProcessParametersVisualTreeChild(dp, target); // name string will get interned } DynamicResourceExtension dynamicResource = value as DynamicResourceExtension; if (dynamicResource == null) { AddToPropertyValues(target, dp, value, PropertyValueType.Trigger); } else { AddToPropertyValues(target, dp, dynamicResource.ResourceKey, PropertyValueType.PropertyTriggerResource); } } else { throw new InvalidOperationException(SR.Get(SRID.VisualTriggerSettersIncludeUnsupportedSetterType, setters[i].GetType().Name)); } } } }
void IAddChild.AddChild(object child) { if (child == null) { throw new ArgumentNullException("child"); } if (child is SetterBase == false) { throw new Exception(string.Format("Cannot convert '{0}' to type '{1}'", child.GetType(), typeof (SetterBase))); } if (_setters == null) { _setters = new SetterBaseCollection(); } _setters.Add((SetterBase)child); }
void IAddChild.AddChild(object child) { if (child == null) { throw new ArgumentNullException("child"); } if (child is SetterBase == false) { throw new Exception(string.Format("Cannot convert '{0}' to type '{1}'", child.GetType(), typeof(SetterBase))); } if (_setters == null) { _setters = new SetterBaseCollection(); } _setters.Add((SetterBase)child); }
// Token: 0x06000CBD RID: 3261 RVA: 0x0002F8AC File Offset: 0x0002DAAC internal void ProcessSettersCollection(SetterBaseCollection setters) { if (setters != null) { setters.Seal(); for (int i = 0; i < setters.Count; i++) { Setter setter = setters[i] as Setter; if (setter == null) { throw new InvalidOperationException(SR.Get("VisualTriggerSettersIncludeUnsupportedSetterType", new object[] { setters[i].GetType().Name })); } DependencyProperty property = setter.Property; object valueInternal = setter.ValueInternal; string text = setter.TargetName; if (text == null) { this.ProcessParametersContainer(property); text = "~Self"; } else { text = this.ProcessParametersVisualTreeChild(property, text); } DynamicResourceExtension dynamicResourceExtension = valueInternal as DynamicResourceExtension; if (dynamicResourceExtension == null) { this.AddToPropertyValues(text, property, valueInternal, PropertyValueType.Trigger); } else { this.AddToPropertyValues(text, property, dynamicResourceExtension.ResourceKey, PropertyValueType.PropertyTriggerResource); } } } }
// This will transfer information in the _setters collection to PropertyValues array. internal void ProcessSettersCollection(SetterBaseCollection setters) { // Add information in Setters collection to PropertyValues array. if( setters != null ) { // Seal Setters setters.Seal(); for (int i = 0; i < setters.Count; i++ ) { Setter setter = setters[i] as Setter; if( setter != null ) { DependencyProperty dp = setter.Property; object value = setter.ValueInternal; string target = setter.TargetName; if( target == null ) { ProcessParametersContainer(dp); target = StyleHelper.SelfName; } else { target = ProcessParametersVisualTreeChild(dp, target); // name string will get interned } DynamicResourceExtension dynamicResource = value as DynamicResourceExtension; if (dynamicResource == null) { AddToPropertyValues(target, dp, value, PropertyValueType.Trigger); } else { AddToPropertyValues(target, dp, dynamicResource.ResourceKey, PropertyValueType.PropertyTriggerResource); } } else { throw new InvalidOperationException(SR.Get(SRID.VisualTriggerSettersIncludeUnsupportedSetterType, setters[i].GetType().Name)); } } } }
public Style() { this.setters = new SetterBaseCollection(); }
public void SetterStillSealedAfterRemove () { Setter s = new Setter (UIElement.OpacityProperty, 2.0); SetterBaseCollection sbc = new SetterBaseCollection (); Assert.IsFalse (sbc.IsSealed, "SetterBaseCollection.IsSealed-1"); Assert.IsFalse (s.IsSealed, "Setter.IsSealed-1"); sbc.Add (s); Assert.IsFalse (sbc.IsSealed, "SetterBaseCollection.IsSealed-2"); Assert.IsTrue (s.IsSealed, "Setter.IsSealed-2"); sbc.Remove (s); Assert.IsFalse (sbc.IsSealed, "SetterBaseCollection.IsSealed-3"); Assert.IsTrue (s.IsSealed, "Setter.IsSealed-3"); }
public void Remove () { SetterBaseCollection sbc = new SetterBaseCollection (); Assert.IsFalse (sbc.Remove (null), "null"); Assert.IsFalse (sbc.Remove (new Setter ()), "Empty"); }
public void Add () { SetterBaseCollection sbc = new SetterBaseCollection (); Assert.Throws<ArgumentNullException> (delegate { sbc.Add (null); }, "Add(null)"); Assert.Throws<Exception> (delegate { sbc.Add (new Setter ()); }, "Add(Empty)"); }