Overblog Suivre ce blog
Editer l'article Administration Créer mon blog

Présentation

  • : Romagny13 - Du .NET,du pur .NET
  • Romagny13 - Du .NET,du pur .NET
  • : Cycle de progression Faire (quelque chose qui marche) -> comprendre ce que l’on fait/comment cela marche -> pousser plus loin les notions
  • Contact

Recherche

Articles Récents

7 mai 2014 3 07 /05 /mai /2014 12:26

 ListView

On peut utiliser une CollectionViewSource groupée ou non

<Page.Resources>

        <CollectionViewSource x:Name="groupedItemsViewSource"

                              Source="{Binding Countries}"

                              ItemsPath="Persons"

                              IsSourceGrouped="True" />

        <CollectionViewSource x:Name="nonGroupedItemsViewSource"

                              Source="{Binding PersonsWithCountries}"

                              IsSourceGrouped="False" />

    </Page.Resources>

 

        <ListView x:Name="lv"  ItemsSource="{Binding Source={StaticResource  groupedItemsViewSource}}">

            <ListView.ItemTemplate>

                <DataTemplate>

                    <Grid Margin="6">

                        <Grid.ColumnDefinitions>

                            <ColumnDefinition Width="Auto"/>

                            <ColumnDefinition Width="*"/>

                        </Grid.ColumnDefinitions>

                        <Border Background="{ThemeResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="60" Height="60">

                            <Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>

                        </Border>

                        <StackPanel Grid.Column="1" Margin="10,0,0,0">

                            <TextBlock Text="{Binding FullName}" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap" MaxHeight="40"/>

                        </StackPanel>

                    </Grid>

                </DataTemplate>

            </ListView.ItemTemplate>

            <ItemsControl.ItemContainerStyle>

                <Style TargetType="FrameworkElement">

                    <Setter Property="Margin" Value="0,0,0,10"/>

                </Style>

            </ItemsControl.ItemContainerStyle>

        </ListView>

   

FlipView    

J’utilise la CollectionViewSource de l’exemple précédent

<FlipView ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}" Width="480" Height="270"

              BorderBrush="Black" BorderThickness="1">

            <FlipView.ItemTemplate>

                <DataTemplate>

                    <Grid>

                        <Image Width="480" Height="270" Source="{Binding Image}" Stretch="UniformToFill"/>

                        <Border Background="#A5000000" Height="80" VerticalAlignment="Bottom">

                            <TextBlock Text="{Binding FullName}" FontFamily="Segoe UI" FontSize="26.667" Foreground="#CCFFFFFF" Padding="15,20"/>

                        </Border>

                    </Grid>

                </DataTemplate>

            </FlipView.ItemTemplate>

        </FlipView>

Partager cet article

Repost 0
Published by Romagny13 - dans WinRT
commenter cet article

commentaires