Ejemplo n.º 1
0
        private static void OnRenderFocusedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            ListBoxChrome chrome = ((ListBoxChrome)o);

            chrome._localResources = null;
            chrome.InvalidateVisual();
        }
Ejemplo n.º 2
0
        private static void OnRenderMouseOverChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            ListBoxChrome chrome = ((ListBoxChrome)o);

            if (chrome.RenderFocused)
            {
                return;
            }

            if (chrome.Animates)
            {
                if (((bool)e.NewValue))
                {
                    if (chrome._localResources == null)
                    {
                        chrome._localResources = new LocalResources();
                        chrome.InvalidateVisual();
                    }

                    Duration duration = new Duration(TimeSpan.FromSeconds(0.3));

                    DoubleAnimation da = new DoubleAnimation(1, duration);

                    chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, da);
                }
                else if (chrome._localResources == null)
                {
                    chrome.InvalidateVisual();
                }
                else
                {
                    Duration duration = new Duration(TimeSpan.FromSeconds(0.2));

                    DoubleAnimation da = new DoubleAnimation();
                    da.Duration = duration;

                    chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, da);
                }
            }
            else
            {
                chrome._localResources = null;
                chrome.InvalidateVisual();
            }
        }