AdornerLayer on ListBox not redrawing
In my apps I use CircularProgressBar from http://sachabarber.net/?p=639.
In one app I place it on AdornerLayer I get from Image element and it works as expected (i.e. the element is animated by rotation driven by a timer).
In another app I place it on AdornerLayer I get from ListBox element and it's shown but no开发者_运维问答t animated. It does get animated while I resize the window which I think means that for some reason AdornerLayer is not being redrawn when the element changes (unless I force a refresh e.g. by resizing a window).
It is also properly animated when I hold Alt key (I have no theory to explain this).
In both cases I use this code to create an adorner:
var adornerLayer = AdornerLayer.GetAdornerLayer(ListBoxDirOrImageElement);
if (null == adornerLayer)
return;
var vb = new Viewbox();
vb.Width = 16;
vb.Height = 16;
vb.Child = new CircularProgressBar();
var adorner = new UpperRightAdorner(ListBoxDir, vb);
adornerLayer.Add(adorner);
The only difference I've noticed so far between the 2 programs is the element I'm adorning (works on Image, doesn't work on ListBox).
Any thoughts why that might be and how to fix that or some other explanation why adorner on ListBox is not being repainted/animated?
精彩评论