c# - Image animation when it's loaded -
i have listbox image control , binding source.
what want: when image loaded (i think it's imageopened event?), animate opacity property 0 100. som apps, facebook, use effect.
image control inside datatemplate , there lot of listbox items.
how solve?
p.s. tried create trigger image control changes opacity property after imageopened event, app crushed without showed causes in debugger.
you may set image opacity
0 , attach imageopened
handler animates opacity
one.
<datatemplate> <image source="{binding}" opacity="0" imageopened="onimageopened"/> </datatemplate>
the imageopened
handler:
private void onimageopened(object sender, routedeventargs e) { var opacityanimation = new doubleanimation { = 1, duration = timespan.fromseconds(1) }; storyboard.settarget(opacityanimation, (dependencyobject)sender); storyboard.settargetproperty(opacityanimation, new propertypath(image.opacityproperty)); var storyboard = new storyboard(); storyboard.children.add(opacityanimation); storyboard.begin(); }
Comments
Post a Comment