Beispiel #1
0
        private static void MiterLimitPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Pen target = ((Pen)d);


            target.PropertyChanged(MiterLimitProperty);
        }
Beispiel #2
0
        private static void StartLineCapPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Pen target = ((Pen)d);


            target.PropertyChanged(StartLineCapProperty);
        }
Beispiel #3
0
        private static void LineJoinPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Pen target = ((Pen)d);


            target.PropertyChanged(LineJoinProperty);
        }
Beispiel #4
0
        private static void ThicknessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Pen target = ((Pen)d);


            target.PropertyChanged(ThicknessProperty);
        }
Beispiel #5
0
        //------------------------------------------------------
        //
        //  Public Properties
        //
        //------------------------------------------------------

        private static void BrushPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // The first change to the default value of a mutable collection property (e.g. GeometryGroup.Children)
            // will promote the property value from a default value to a local value. This is technically a sub-property
            // change because the collection was changed and not a new collection set (GeometryGroup.Children.
            // Add versus GeometryGroup.Children = myNewChildrenCollection). However, we never marshalled
            // the default value to the compositor. If the property changes from a default value, the new local value
            // needs to be marshalled to the compositor. We detect this scenario with the second condition
            // e.OldValueSource != e.NewValueSource. Specifically in this scenario the OldValueSource will be
            // Default and the NewValueSource will be Local.
            if (e.IsASubPropertyChange &&
                (e.OldValueSource == e.NewValueSource))
            {
                return;
            }


            Pen target = ((Pen)d);


            Brush oldV = (Brush)e.OldValue;
            Brush newV = (Brush)e.NewValue;

            System.Windows.Threading.Dispatcher dispatcher = target.Dispatcher;

            if (dispatcher != null)
            {
                DUCE.IResource targetResource = (DUCE.IResource)target;
                using (CompositionEngineLock.Acquire())
                {
                    int channelCount = targetResource.GetChannelCount();

                    for (int channelIndex = 0; channelIndex < channelCount; channelIndex++)
                    {
                        DUCE.Channel channel = targetResource.GetChannel(channelIndex);
                        Debug.Assert(!channel.IsOutOfBandChannel);
                        Debug.Assert(!targetResource.GetHandle(channel).IsNull);
                        target.ReleaseResource(oldV, channel);
                        target.AddRefResource(newV, channel);
                    }
                }
            }

            target.PropertyChanged(BrushProperty);
        }