2
我在我的XAML下面的示例數據設置:ItemsWrapGrid秩序的Windows Phone 8.1
<vm:SoundModel.Animals>
<vm:SoundGroup Title="Animals">
<vm:SoundGroup.Items>
<vm:SoundData Title="Animal 1" FilePath="Animal1.wav" />
<vm:SoundData Title="Animal 2" FilePath="Animal2.wav" />
<vm:SoundData Title="Animal 3" FilePath="Animal3.wav" />
</vm:SoundGroup.Items>
</vm:SoundGroup>
</vm:SoundModel.Animals>
而在我的XAML我有以下幾點:
<Page.Resources>
<DataTemplate x:Key="SoundTileDataTemplate">
<Grid Background="{StaticResource PhoneAccentBrush}" Margin="0, 0, 20, 20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="170" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="150" />
</Grid.RowDefinitions>
<Grid VerticalAlignment="Top" HorizontalAlignment="Right" Width="40" Height="40" Margin="0, 10, 10, 0">
<Ellipse Stroke="{StaticResource PhoneForegroundBrush}" StrokeThickness="3" />
<Image Source="Assets/AppBar/play.png" />
</Grid>
<StackPanel VerticalAlignment="Bottom" Margin="6, 0, 0, 6">
<TextBlock Text="{Binding Title}" FontSize="30" />
</StackPanel>
</Grid>
</DataTemplate>
</Page.Resources>
<Pivot x:Uid="Pvt">
<PivotItem Header="{Binding Animals.Title}">
<ListView ItemsSource="{Binding Animals.Items}" ItemTemplate="{StaticResource SoundTileDataTemplate}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid MaximumRowsOrColumns="2" Orientation="Vertical"></ItemsWrapGrid>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
</PivotItem>
</Pivot>
上面給了我以下內容:
必須我改變什麼代碼,以便它流向由左到右?所以Animal 3
應該在底部。我已經嘗試設置Orientation="Horizontal"
,讓我:
感謝
查看更新後問:謝謝。 – Ciwan
@Ciwan很確定,我過去做過這件事。如果其他人沒有糾正我的情況,我會在下班時多看一看。也許更改ListView的垂直/水平對齊不是'Stretch'。 –
剛剛嘗試過,並且再次沒有任何東西:( – Ciwan