Example #1
0
        private static void UpdateIsShowing(DependencyObject element)
        {
            if (element == null)
            {
                return;
            }

            if (!Visible.IsVisible(element) ||
                !Loaded.IsLoaded(element))
            {
                element.SetIsShowing(false);
                return;
            }

            var isVisible = GetIsVisible(element);

            if (isVisible != null)
            {
                element.SetIsShowing(isVisible.Value);
                return;
            }

            var content = GetContent(element);

            element.SetIsShowing(content != null);
        }
Example #2
0
 static Info()
 {
     EventManager.RegisterClassHandler(typeof(UIElement), FrameworkElement.SizeChangedEvent, new RoutedEventHandler(OnSizeChanged));
     Loaded.Track();
     EventManager.RegisterClassHandler(typeof(UIElement), FrameworkElement.LoadedEvent, new RoutedEventHandler(OnLoaded));
     EventManager.RegisterClassHandler(typeof(UIElement), FrameworkElement.UnloadedEvent, new RoutedEventHandler(OnUnLoaded));
     EventManager.RegisterClassHandler(typeof(UIElement), Visible.IsVisibleChangedEvent, new RoutedEventHandler(OnIsVisibleChanged));
 }
Example #3
0
 static Watermark()
 {
     EventManager.RegisterClassHandler(typeof(TextBox), FrameworkElement.SizeChangedEvent, new RoutedEventHandler(OnSizeChanged));
     Loaded.Track();
     EventManager.RegisterClassHandler(typeof(TextBox), FrameworkElement.LoadedEvent, new RoutedEventHandler(OnLoaded));
     EventManager.RegisterClassHandler(typeof(TextBox), FrameworkElement.UnloadedEvent, new RoutedEventHandler(OnUnLoaded));
     EventManager.RegisterClassHandler(typeof(TextBox), Visible.IsVisibleChangedEvent, new RoutedEventHandler(OnIsVisibleChanged));
     EventManager.RegisterClassHandler(typeof(TextBox), UIElement.GotKeyboardFocusEvent, new RoutedEventHandler(OnGotKeyboardFocus));
     EventManager.RegisterClassHandler(typeof(TextBox), UIElement.LostKeyboardFocusEvent, new RoutedEventHandler(OnLostKeyboardFocus));
     EventManager.RegisterClassHandler(typeof(TextBox), TextBoxBase.TextChangedEvent, new RoutedEventHandler(OnTextChanged));
 }
Example #4
0
        private static void UpdateIsShowing(DependencyObject o)
        {
            if (o is UIElement element)
            {
                if (!element.IsVisible ||
                    !Loaded.IsLoaded(element))
                {
                    element.SetIsShowing(false);
                    return;
                }

                var template  = GetTemplate(element);
                var isVisible = GetIsVisible(element);
                if (template != null && isVisible != null)
                {
                    element.SetIsShowing(isVisible.Value);
                    return;
                }

                element.SetIsShowing(template != null);
            }
        }