Example #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));
                    }
                }
            }
        }
Example #2
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);
             }
         }
     }
 }
Example #3
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));
                    }
                }
            }
        }