2012-11-07 2 views
0

J'ai le code suivant sur ma page.Windows 8 XAML - Problème avec GridView en utilisant VariableSizeWrapGrid

<Page 
    x:Class="MyPage.MainPage" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:local="using:MyProject" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"> 
    <ScrollViewer> 
     <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="10*" /> 
       <RowDefinition Height="400*" /> 
      </Grid.RowDefinitions> 
      <TextBlock Grid.Row="0" Text="Some Header" FontSize="48" Margin="100, 50, 0, 0" /> 
      <local:CustomGridView Grid.Row="1" HorizontalAlignment="Left" Margin="100, 0, 0, 0" ItemsSource="{Binding CollectionOfYears}"> 
       <GridView.ItemsPanel> 
        <ItemsPanelTemplate> 
         <VariableSizedWrapGrid Orientation="Vertical" /> 
        </ItemsPanelTemplate> 
       </GridView.ItemsPanel> 
       <GridView.ItemTemplate> 
        <DataTemplate> 
         <Grid Height="200" Width="200"> 
          <Grid.Background> 
           <SolidColorBrush Color="{Binding Color}" /> 
          </Grid.Background> 
          <StackPanel VerticalAlignment="Bottom"> 
           <StackPanel.Background> 
            <SolidColorBrush Color="Black" Opacity="0.5" /> 
           </StackPanel.Background> 
           <TextBlock FontSize="24" Margin="10" TextAlignment="Center" Text="{Binding Year}" /> 
          </StackPanel> 
         </Grid> 
        </DataTemplate> 
       </GridView.ItemTemplate> 
      </local:CustomGridView> 
     </Grid> 
    </ScrollViewer> 
</Page> 

Maintenant, j'obtiens l'image suivante comme ma page.

https://skydrive.live.com/redir?resid=59DBB22BE5D0430E!279

Comment faire faire le gridview remplir l'espace de l'espace restant i.e. gauche après le TextBlock est rempli? Et puis, comment puis-je obtenir le flux de variablesizewrapgrid au lieu de couler tout en remplissant la deuxième tuile ci-dessous le premier et ainsi de suite?

EDIT: Je cherche à obtenir une finition de magasin Windows sur le groupe. Un gros objet et le reste s'enroulent autour.

Répondre

0

OK. Compris le problème.

Étape 1: Retirez la visionneuse à défilement.

Étape 2: définissez la hauteur de la première ligne de la grille sur une valeur fixe.

Étape 3: Définissez la hauteur de la deuxième ligne de la grille sur *.

Étape 4: Débarrassez-vous de la marge sur le bloc de texte.

Étape 5: Utilisez un remplissage au lieu de marge sur la vue de la grille.

Cela aidera à résoudre certains problèmes.

Questions connexes