c# - assigning a storyboard for all objects -
i need assign storyboard animation created 16 pictures working vs2012 blend windows phone
the animation fading out , did 1 picture check if works , , worked , need set controlpropetyaction
each picture animation
so selected pictures , recorded animation in blend , when play makes all pictures fade out ! need each picture fade out when it's tapped !
how can ? (without having 16 animation types)
code animation in xaml:
<image x:name="pic1" margin="12,33,372,562" grid.row="1" source="/assets/1395704999_red-21.png" stretch="fill"> <i:interaction.triggers> <i:eventtrigger eventname="tap"> <eim:controlstoryboardaction storyboard="{staticresource fadeoutanimation}"/> </i:eventtrigger> </i:interaction.triggers> </image>
based on your previous question, sample of xaml using
<storyboard> <doubleanimation storyboard.targetname="imagename" storyboard.targetproperty="opacity" from="1.0" to="0.0" duration="0:0:1"/> </storyboard>
this can translated code easily.
var story = new storyboard(); var animation = new doubleanimation { duration = timespan.fromseconds(1), = 0, = 1}; storyboard.settargetproperty(animation, new propertypath("opacity")); storyboard.settarget(animation, your_ui_element_here); story.children.add(animation); story.begin();
if subscribing tap event of elements, sender
uielement
private void gridontap(object sender, gestureeventargs gestureeventargs) { uielement element = (uielement)sender; // call code above, replace your_ui_element_here }
Comments
Post a Comment