예제 #1
0
        private static void OnRenderFocusedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            ListBoxChrome listBoxChrome = (ListBoxChrome)o;

            listBoxChrome._localResources = (ListBoxChrome.LocalResources)null;
            listBoxChrome.InvalidateVisual();
        }
예제 #2
0
        private static void OnRenderMouseOverChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            ListBoxChrome listBoxChrome = (ListBoxChrome)o;

            if (listBoxChrome.RenderFocused)
            {
                return;
            }
            if (listBoxChrome.Animates)
            {
                if ((bool)e.NewValue)
                {
                    if (listBoxChrome._localResources == null)
                    {
                        listBoxChrome._localResources = new ListBoxChrome.LocalResources();
                        listBoxChrome.InvalidateVisual();
                    }
                    DoubleAnimation doubleAnimation = new DoubleAnimation(1.0, new Duration(TimeSpan.FromSeconds(0.3)));
                    listBoxChrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, (AnimationTimeline)doubleAnimation);
                }
                else if (listBoxChrome._localResources == null)
                {
                    listBoxChrome.InvalidateVisual();
                }
                else
                {
                    Duration        duration        = new Duration(TimeSpan.FromSeconds(0.2));
                    DoubleAnimation doubleAnimation = new DoubleAnimation();
                    doubleAnimation.Duration = duration;
                    listBoxChrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, (AnimationTimeline)doubleAnimation);
                }
            }
            else
            {
                listBoxChrome._localResources = (ListBoxChrome.LocalResources)null;
                listBoxChrome.InvalidateVisual();
            }
        }