本文介绍了flipView和页面指标UWP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在面临的同步与页标志的FlipView一个问题,这是我的代码:
I am facing a problem in synchronising the FlipView with the Page Indicator,this is my code:
<Grid> <FlipView x:Name="flipView1"> <FlipView.ItemTemplate> <DataTemplate > <Grid Background="Transparent"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Button Grid.Column="0" Grid.Row="0"> <Image Source="{Binding Image}"/> </Button> </Grid> </DataTemplate> </FlipView.ItemTemplate> </FlipView> <ItemsControl ItemsSource="{Binding ItemsSource, ElementName=flipView1}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Button Style="{StaticResource TextBlockButtonStyle}" CommandParameter="{Binding}" Command="{Binding DataContext.SelectCommand, ElementName=grid, Mode=OneWay}"> <Grid Height="30" Width="30" Margin="10,10"> <Ellipse Fill="#2c3389" RenderTransformOrigin="0.5,0.5" > <Ellipse.RenderTransform> <CompositeTransform ScaleX="1.25" ScaleY="1.25"/> </Ellipse.RenderTransform> </Ellipse> <Ellipse Fill="Gray" Stroke="#2c3389" /> </Grid>和这是我得到的ItemSource到FlipView在后面的代码:
and this is how I get the ItemSource to the FlipView in the code behind:
var tests = new List<SampleItem>() { test1, test2 }; flipView1.ItemsSource = tests; }
我可以从一个页面移动到另一个我flipView,但页面指示符不工作:/ 任何帮助,请,我怎么能约束双方的FlipView和的ItemsControl到同一个集合
I can move from one page to another with my flipView,but the page indicator doesn't work :/ any help please,how can I bound Both the FlipView and the ItemsControl to same collection
感谢您的帮助。
推荐答案您应该绑定您的ItemsControl的selectedIndex:
You should bind the selectedIndex of your ItemsControl :
<ItemsControl SelectedIndex="{Binding SelectedIndex, ElementName=flipView1}" ItemsSource="{Binding ItemsSource, ElementName=flipView1}" > </ItemsControl>更多推荐
flipView和页面指标UWP
发布评论