예제 #1
0
        // 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));
                    }
                }
            }
        }
예제 #2
0
    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);
    }
예제 #3
0
        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);
        }
예제 #4
0
 // 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);
             }
         }
     }
 }
예제 #5
0
        // 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));
                    }
                }
            }
        }
예제 #6
0
파일: Style.cs 프로젝트: evnik/UIFramework
 public Style()
 {
     this.setters = new SetterBaseCollection();
 }
예제 #7
0
		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");
		}
예제 #8
0
		public void Remove ()
		{
			SetterBaseCollection sbc = new SetterBaseCollection ();
			Assert.IsFalse (sbc.Remove (null), "null");
			Assert.IsFalse (sbc.Remove (new Setter ()), "Empty");
		}
예제 #9
0
		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)");
		}