-1
ここに私のXAMLコードXAML 1列にgridviewを表示する方法は?
<Page
x:Class="GridView_Test.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:GridView_Test"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:data="using:GridView_Test.Model"
mc:Ignorable="d" >
<Page.Resources>
<DataTemplate x:DataType="data:Song" x:Key="SongItemTemplate" >
<StackPanel HorizontalAlignment="Stretch" Width="auto">
<Image Source="{x:Bind ThumbImage}" Width="150" HorizontalAlignment="Center" />
<TextBlock FontSize="16" Text="{x:Bind Title}" HorizontalAlignment="Center" />
<TextBlock FontSize="12" Text="{x:Bind Author}" HorizontalAlignment="Center" />
</StackPanel>
</DataTemplate>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<GridView ItemsSource="{x:Bind Songs}" Name="grid1" ItemTemplate="{StaticResource SongItemTemplate}" >
</GridView>
</Grid>
私はリストビューのように、1列にアイテムを作成する必要があります。グリッドビュー項目のデフォルトでは、表のように表示されます。リストが必要です。ありがとう。
なぜあなたはちょうどそのリストビューを使用していない以下のコードに示すようGridViewのにGrid.Rowプロパティを追加しますか? – Bart
@Bartありがとう、素晴らしい作品。どのようにスタックパネルですべてのリストビューを埋めるのですか? 100%の幅を作る? –