private static void OnRenderFocusedChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { ListBoxChrome chrome = ((ListBoxChrome)o); chrome._localResources = null; chrome.InvalidateVisual(); }
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(); } }