flipView and Page indicator UWP

uwp flipview context indicator
uwp listview
flipview android
uwp dialog
uwp popup
uwp pivot
uwp treeview
forms in uwp

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>

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;
        }

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

thanks for help


You should bind the selectedIndex of your ItemsControl :

<ItemsControl SelectedIndex="{Binding SelectedIndex, ElementName=flipView1}"
 ItemsSource="{Binding ItemsSource, ElementName=flipView1}" >

</ItemsControl>

Guidelines for flip view controls, Use a flip view for browsing images or other items in a collection, such as photos in an album or items in a Example of a page indicator. Create a flip view. FlipView is an ItemsControl, so it can contain a collection of items of any type. To populate the view, add items to the Items collection, or set the ItemsSource property to a data source. By default, a data item is displayed in the flip view as the string representation of the data object it's bound to.


for UWP there is no SelectedIndex event in ItemsControl so I used Gridview instead

 <GridView Grid.Row="1" Grid.Column="0" ItemsSource="{Binding ItemsSource, ElementName=companiesFlipView}" 
                      SelectedIndex="{Binding SelectedIndex, ElementName=companiesFlipView}" VerticalAlignment="Bottom" 
                      IsItemClickEnabled="False"
                      IsEnabled="False"
                      HorizontalAlignment="Center" Margin="0,10">
                    <GridView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal">
                            </StackPanel>
                        </ItemsPanelTemplate>
                    </GridView.ItemsPanel>
                    <GridView.ItemTemplate>
                        <DataTemplate>
                            <Grid Width="10" Height="10">
                                <Ellipse Fill="Black"></Ellipse>
                            </Grid>
                        </DataTemplate>
                    </GridView.ItemTemplate>
                </GridView>

we can improve the styles for selected item :)

How to Context Page indicator to a FlipView #UWP, How to add a context indicator to a FlipView? FlipView with orientation vertical image slider Duration: 5:45 Posted: Jul 2, 2016 Introduction To Universal Windows Platform (UWP) App Development Using Windows 10 And Visual Studio 2015; Reading this article, you can learn how to use FlipViewControl in Universal Windows Apps development with XAML and Visual C#. The following important tools are required for developing UWP, Windows 10 (Recommended)


Aditional style indicator

<Style x:Key="LegendItemContainerStyle" TargetType="GridViewItem">
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
        <Setter Property="TabNavigation" Value="Local" />
        <Setter Property="IsHoldingEnabled" Value="True" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Margin" Value="0,0,4,4" />
        <Setter Property="MinWidth" Value="15" />
        <Setter Property="MinHeight" Value="{ThemeResource GridViewItemMinHeight}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GridViewItem">
                    <Grid>
                        <!--We add the actual control in the container because we need the selection state to change
                        the control's color.-->
                        <Ellipse Width="5" Height="5"
                                 Fill="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent},
                            Converter={StaticResource SelectedLegendItemToColorConverter}}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

FlipView

<FlipView Visibility="Visible" x:Name="flipView" SelectedItem="{Binding SelectedInstructionItem, Mode=TwoWay}"
              Background="#FF494949" ItemsSource="{Binding InstructionItems}">
        <FlipView.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="{StaticResource FirstRowHeight}" />
                        <RowDefinition Height="{StaticResource SecondRowHeight}" />
                    </Grid.RowDefinitions>

                    <Grid Grid.Row="0" VerticalAlignment="Bottom">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ChildrenTransitions>
                            <TransitionCollection>
                                <EdgeUIThemeTransition Edge="Left" />
                            </TransitionCollection>
                        </Grid.ChildrenTransitions>

                        <TextBlock Text="{Binding HeaderText}"
                                   Style="{StaticResource TextHeaderStyle}" />

                        <Image Stretch="Uniform" MaxWidth="335" Grid.Row="1"
                               Source="{Binding Image}" Margin="36,0"
                               Visibility="{Binding Image, Converter={StaticResource NullToVisibilityConverter}}" />

                        <Button Content="Get Started" HorizontalAlignment="Center"
                                Grid.Row="1"
                                Visibility="{Binding TargetPage, Converter={StaticResource NullToVisibilityConverter}}"
                                VerticalAlignment="Bottom" Margin="0,32"
                                Style="{StaticResource ColoredButtonStyle}"
                                Command="{Binding DataContext.NavigateToTargetPageCommand,
                                    ElementName=pageRoot}"
                                Click="Button_Click"
                                CommandParameter="{Binding}" />
                    </Grid>

                    <Image Grid.Row="0" Source="/Assets/Welcome/gradient-white.png"
                           Height="26" MaxWidth="500" Stretch="Fill"
                           VerticalAlignment="Bottom" Margin="0,0,0,-10" />

                    <Grid Grid.Row="1" Background="{StaticResource SystemControlBackgroundAccentBrush}">
                        <Grid Style="{StaticResource TextGridStyle}">
                            <StackPanel>
                                <StackPanel.ChildrenTransitions>
                                    <TransitionCollection>
                                        <EdgeUIThemeTransition Edge="Bottom" />
                                    </TransitionCollection>
                                </StackPanel.ChildrenTransitions>
                                <TextBlock  Style="{StaticResource TextContentStyle}"
                                           Text="{Binding ContentText}" />
                            </StackPanel>
                        </Grid>
                    </Grid>

                </Grid>
            </DataTemplate>
        </FlipView.ItemTemplate>
    </FlipView>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="{StaticResource FirstRowHeight}" />
            <RowDefinition Height="{StaticResource SecondRowHeight}" />
        </Grid.RowDefinitions>

        <GridView Grid.Row="1" HorizontalAlignment="Center"
                  SelectedItem="{Binding SelectedInstructionItem, Mode=TwoWay}"
                  ItemsSource="{Binding InstructionItems}"
                  ItemContainerStyle="{StaticResource LegendItemContainerStyle}" />
    </Grid>
</Grid>

Converter

public class SelectedLegendItemToColorConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, string language)
    {
        var isSelected = (bool) value;
        return isSelected
            ? Application.Current.Resources["SystemControlForegroundBaseMediumBrush"] as Brush
            : Application.Current.Resources["SystemControlForegroundListMediumBrush"] as Brush;
    }
    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
        throw new NotImplementedException();
    }
}

UWP, Download Sample Project on GitHub: https://github.com/IvanResh/FlipView-Page​-Indicator.Duration: 3:02 Posted: Nov 10, 2017 FlipView is an ItemsControl, so it can contain a collection of items of any type. To populate the view, add items to the Items collection, or set the ItemsSource property to a data source. By default, a data item is displayed in the FlipView as the string representation of the data object it's bound to.


flipView and Page indicator UWP, Hi, I am facing a problem in synchronising the FlipView with the Page Indicator,​this is my code: x:Name = "flipView1" > > Background  Change UWP FlipView Is it possible to change the animation effect when changing images in an UWP Flipview control? Instead of sliding in, I would prefer a cross fade effect. I did not see a way to do it, but I wanted to confirm. Any help is appreciated. Thanks.You shoul


Let's Code: Build your own FlipView Page Indicator, One of the benefits of XAML data binding is that it lets different elements on one UI use the same data. The WinRT-XAML FlipView inherits from  Universal Windows Platform (UWP) Samples. Contribute to jQuery2DotNet/UWP-Samples development by creating an account on GitHub.


Diederik Krols, This article presents a FlipView context indicator control for Windows 8 UI In an app, the maximum size of a flipview is the size of the page. Without some type of page or context indicator, the FlipView is a mystery to the user. And, that’s what we’re after today – building our own page indicator for the FlipView control. On an Apple device, the main screen (the equivalent to the Start Screen on Windows Phone) doesn’t scroll vertically or horizontally.