问题
I have a listview that is populated during runtime from a webservice. Inside the data template of the listview I have made flipview, each flipview gets three images that user can swipe. I have attached an image of what i am looking for.
ISSUE
The flipview doesnt get user interactions. here is the xaml below
<ListView ManipulationMode="None" IsZoomedInView="False" IsSwipeEnabled="False" >
<ListView.ItemTemplate >
<DataTemplate>
<Grid>
<FlipView ItemsSource="{Binding image}" ManipulationMode="All">
<FlipView.ItemTemplate>
<DataTemplate>
<Image Source="{Binding image}" Stretch="Fill"></Image>
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
回答1:
you have to apply a workaround here.
- use gridview instead of flipview.
- edit the template of the gridview(remove it and add (copy/paste) a flipview template instead)
next, the trick,
- change the target type of pasted tempate to gridview
- find/replace all other flipview tags inside the template with gridview tags
- last step,bind this new template to the gridview (inside that listview)
回答2:
You can Add ItemsControl instead of ListView as ListView has some problems with inner controls that use horizontal gestures.
<ItemsControl>
<ItemsControl.ItemTemplate >
<DataTemplate>
<Grid>
<FlipView ItemsSource="{Binding image}" ManipulationMode="All">
<FlipView.ItemTemplate>
<DataTemplate>
<Image Source="{Binding image}" Stretch="Fill"></Image>
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
You may need to add ScrollViewer manually as ItemsControl doesn't have one
来源:https://stackoverflow.com/questions/27917717/flipviews-inside-dynamic-listview-not-swipable