Animation when add or remove item from GridView XAML -
how create own animation when item add or remove gridview? example change colour dark light.
if item grid:
<grid.transitions> --> there can predefinied *themetransitions? </grid.transitions>
is other way this?
tim correct transitions pre-defined @ point. however, should able achieve scenario using storyboard. there several ways this, e.g. retemplating gridviewitem , adding new "loading"/"unloading" visual states. here simple way achieve scenario putting storyboard in itemtemplate:
mainpage.xaml:
<gridview x:name="mygv"> <gridview.itemtemplate> <datatemplate> <grid loaded="grid_loaded" x:name="templateroot" opacity="0" background="white"> <grid.resources> <storyboard x:key="loadedstoryboard"> <doubleanimation storyboard.targetname="templateroot" storyboard.targetproperty="opacity" begintime="0:0:1" duration="0:0:5" to="1" /> </storyboard> </grid.resources> <textblock text="{binding}" fontsize="24" foreground="black" margin="40" /> </grid> </datatemplate> </gridview.itemtemplate> </gridview>
mainpage.xaml.cs:
private void grid_loaded(object sender, routedeventargs e) { storyboard sb = ((grid)sender).resources["loadedstoryboard"] storyboard; sb.begin(); }
example source code hosted here: https://github.com/finnigantime/samples/tree/master/examples/win8xaml/gridviewitemloadedunloadedanimations
Comments
Post a Comment