Adding Visual States to a Data Template in Windows 8

▼魔方 西西 提交于 2019-12-04 09:57:10

Xaml you provided in your question is not going to work on its own. Simply defining visual states is not enough. You also need some kind of code to call VisualStateManager.GoToState.

In your particular case solution is not to add visual states to DataTemplate, but to create custom template for GridViewItem. In general GridViewItem is responsible for decorating elements inside the GridView with common pointer, selection, drag and drop states.

Add UserControl balise it works, (don't know why)

 <DataTemplate x:Key="GameTileTemplate">
<UserControl>
<Grid x:Name="grid" Width="173" Height="173" RenderTransformOrigin="0.5,0.5" >
        <Grid.Clip>
....

...
 </VisualStateManager.VisualStateGroups>
    </Grid>
</UserControl>
</DataTemplate>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!