Пример #1
0
        private static void StyleSheetPropertyChanged(BindableObject bindableObject, object oldValue, object newValue)
        {
            var element = bindableObject as Element;

            if (oldValue != null)
            {
                var oldStyleSheet = oldValue as StyleSheet;
                oldStyleSheet.PropertyChanged -= StyleSheet_PropertyChanged;
                //oldStyleSheet.AttachedTo = null;

                instance?.EnqueueRemoveStyleSheet(element, (StyleSheet)oldValue);
            }

            var newStyleSheet = (StyleSheet)newValue;

            if (newStyleSheet == null)
            {
                return;
            }

            newStyleSheet.PropertyChanged += StyleSheet_PropertyChanged;
            newStyleSheet.AttachedTo       = element;

            instance?.EnqueueRenderStyleSheet(element, newStyleSheet);
        }
Пример #2
0
        private static void StyleSheetPropertyChanged(DependencyObject element, DependencyPropertyChangedEventArgs e)
        {
            if (e.OldValue == e.NewValue)
            {
                return;
            }

            if (e.OldValue is StyleSheet oldStyleSheet)
            {
                oldStyleSheet.PropertyChanged -= StyleSheet_PropertyChanged;

                if (oldStyleSheet.AttachedTo != null)
                {
                    instance?.EnqueueRemoveStyleSheet(element, (StyleSheet)e.OldValue);
                }
            }

            var newStyleSheet = (StyleSheet)e.NewValue;

            if (newStyleSheet == null)
            {
                return;
            }

            newStyleSheet.PropertyChanged += StyleSheet_PropertyChanged;
            // newStyleSheet.AttachedTo = element;

            instance?.EnqueueRenderStyleSheet(element, e.NewValue as StyleSheet);
        }
Пример #3
0
        private static void StyleSheetPropertyChanged(DependencyObject element, DependencyPropertyChangedEventArgs e)
        {
            // Debug.WriteLine($"StyleSheetPropertyChanged: {e.NewValue.ToString()}");

            if (e.OldValue != null)
            {
                var oldStyleSheet = e.OldValue as StyleSheet;
                oldStyleSheet.PropertyChanged -= NewStyleSheet_PropertyChanged;
                //oldStyleSheet.AttachedTo = null;

                instance?.EnqueueRemoveStyleSheet(element, oldStyleSheet);
            }

            var newStyleSheet = (StyleSheet)e.NewValue;

            if (newStyleSheet == null)
            {
                return;
            }

            newStyleSheet.PropertyChanged += NewStyleSheet_PropertyChanged;
            newStyleSheet.AttachedTo       = element;

            instance?.EnqueueRenderStyleSheet(element, newStyleSheet);
        }
Пример #4
0
        private static void StyleSheet_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var styleSheet = sender as StyleSheet;
            var attachedTo = styleSheet.AttachedTo as FrameworkElement;

            instance.EnqueueRemoveStyleSheet(attachedTo, styleSheet, null);
            instance.EnqueueRenderStyleSheet(attachedTo, styleSheet, null);
        }
Пример #5
0
        private static void StyleSheetPropertyChanged(DependencyObject element, DependencyPropertyChangedEventArgs e)
        {
            if (e.OldValue != null)
            {
                var oldStyleSheet = e.OldValue as StyleSheet;
                oldStyleSheet.PropertyChanged -= NewStyleSheet_PropertyChanged;

                instance?.EnqueueRemoveStyleSheet(element, oldStyleSheet);
            }

            var newStyleSheet = (StyleSheet)e.NewValue;

            if (newStyleSheet == null)
            {
                return;
            }

            newStyleSheet.PropertyChanged += NewStyleSheet_PropertyChanged;

            instance?.EnqueueRenderStyleSheet(element, newStyleSheet);
        }
Пример #6
0
 public static void EnqueueRemoveStyleSheet(Element styleSheetHolder, StyleSheet styleSheet, Element startFrom)
 {
     instance.EnqueueRemoveStyleSheet(styleSheetHolder, styleSheet, startFrom as Element);
 }