現在、Windows Phone 向けのファッション ストア アプリのプロジェクトに取り組んでいます。カタログの場合、縦にスクロールすると同じ製品に関連する画像が表示され、横にスクロールすると次/前の製品が表示される画像ギャラリーを作成する必要があります。
3x3 の画像である小さなコンセプト ギャラリーを作成することから始めました。1 列目は飛行機、2 列目は戦車、3 列目は軍艦です。アイテムとして3つの垂直FlipViewを持つ1つの水平FlipViewを使用しました。
XAML コードは次のとおりです。
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<FlipView x:Name="flipBase">
<FlipView x:Name="a">
<FlipView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</FlipView.ItemsPanel>
</FlipView>
<FlipView x:Name="b">
<FlipView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</FlipView.ItemsPanel>
</FlipView>
<FlipView x:Name="c">
<FlipView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical" />
</ItemsPanelTemplate>
</FlipView.ItemsPanel>
</FlipView>
</FlipView>
</Grid>
C# コードは次のとおりです。
//PRIMEIRA COLUMNA
Image foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/plane/plane_spitfire.jpg"));
a.Items.Add(foto);
foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/plane/plane_stuka.jpg"));
a.Items.Add(foto);
foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/plane/plane_yak9.jpg"));
a.Items.Add(foto);
//SEGUNDA COLUMNA
foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/tank/tank_IS.jpg"));
b.Items.Add(foto);
foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/tank/tank_Patton.jpg"));
b.Items.Add(foto);
foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/tank/tank_Tiger.jpg"));
b.Items.Add(foto);
//TERCEIRA COLUMNA
foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/destroyer/destroyer_german.jpg"));
c.Items.Add(foto);
foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/destroyer/destroyer_russian.jpg"));
c.Items.Add(foto);
foto = new Image();
foto.Source = new BitmapImage(new Uri("ms-appx:///Assets/destroyer/destroyer_usa.jpg"));
c.Items.Add(foto);
}
}
主な質問が 2 つあります。 -これを行うためのより良い方法はありますか? (列とアイテムを動的に追加できるようにするもの) -垂直方向の動きが検出されたときに水平方向の動きを制限するにはどうすればよいですか? (斜めの動きを防ぐために)
これは私の最初の投稿です。回答ありがとうございます。