flipView和页面指标UWP

编程入门 行业动态 更新时间:2024-10-27 06:20:38
本文介绍了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

本文发布于:2023-11-03 06:24:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1554442.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:指标   页面   flipView   UWP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!