Example #1
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.RemoveStyleResources(element, oldStyleSheet);
            }

            var newStyleSheet = (StyleSheet)e.NewValue;

            if (newStyleSheet == null)
            {
                return;
            }

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

            instance.EnqueueRenderStyleSheet(element, newStyleSheet, null);
        }
Example #2
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);
        }
Example #3
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);
        }
Example #4
0
        private static void StyleSheetPropertyChanged(DependencyObject element, DependencyPropertyChangedEventArgs e)
        {
            if (e.OldValue != null)
            {
                (e.OldValue as StyleSheet).PropertyChanged -= StyleSheet_PropertyChanged;

                instance.RemoveStyleResources(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, null);
        }
Example #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);
        }
Example #6
0
File: Css.cs Project: xathu/XamlCSS
 public static void EnqueueRenderStyleSheet(Element styleSheetHolder, StyleSheet styleSheet, Element startFrom)
 {
     instance.EnqueueRenderStyleSheet(styleSheetHolder, styleSheet, startFrom as Element);
 }