Windows应用商店的应用程序,列表视图Groupheaderplacement左和垂直滚动(Wi

2019-10-29 15:15发布

所以,我在与GroupHeaderPlacement和垂直滚动的问题。 什么我试着去实现这一目标是:

但由于某些原因,我群体越来越排列在horisontal滚动方向。 任何人都知道,如果我失去了一些东西明显在这里,或者如果你简单的不能有一个垂直滚动列表视图,如果你有GroupHeaderPlacement左。

的代码是: <ListView x:Name="ItemsGridView" Margin="118,-5,0,0" ItemsSource="{Binding Source={StaticResource AllCurrentGroup}}" SelectionMode="Single" Grid.Row="2" Grid.Column="0" ShowsScrollingPlaceholders="False" SelectionChanged="SelectedPresentationItem_SelectionChanged" IsSwipeEnabled="True"> <ListView.ItemsPanel> <ItemsPanelTemplate> <ItemsWrapGrid GroupHeaderPlacement="Left" Orientation="Vertical" /> </ItemsPanelTemplate> </ListView.ItemsPanel> <ListView.ItemTemplate> <DataTemplate> <StackPanel Grid.Column="1" Height="80" Margin="40,0,0,0" > <TextBlock Text="{Binding Tid }" Style="{StaticResource BodyTextBlockStyle}" Grid.Column="1" > <TextBlock.Foreground> <SolidColorBrush Color="{StaticResource Orange}"/> </TextBlock.Foreground> </TextBlock> <TextBlock Text="{Binding Titel }" Style="{StaticResource SubheaderTextBlockStyle}" Grid.Column="1" /> </StackPanel> </DataTemplate> </ListView.ItemTemplate> <ListView.GroupStyle> <GroupStyle> <GroupStyle.HeaderTemplate> <DataTemplate> <StackPanel Grid.Column="0" Grid.RowSpan="{Binding Rows}" Width="160" Height="200"> <StackPanel.Background> <SolidColorBrush Color="{StaticResource BlueDark}"/> </StackPanel.Background> <TextBlock Text="{Binding Vecka, Converter={StaticResource ToWeekString }}" Style="{StaticResource BodyTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,13,0,0"/> <TextBlock Text="{Binding Datum, Converter={StaticResource ToDayNumber }}" Style="{StaticResource HeaderTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" Margin="20,26,0,0"/> <TextBlock Text="{Binding Datum, Converter={StaticResource ToMonth }}" Style="{StaticResource SubheaderTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,-3,0,0"/> <TextBlock Text="{Binding Datum, Converter={StaticResource ToDayString }}" Style="{StaticResource BodyTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,13,0,0"/> </StackPanel> </DataTemplate> </GroupStyle.HeaderTemplate> <GroupStyle.Panel> <ItemsPanelTemplate> <WrapGrid Orientation="Vertical"></WrapGrid> </ItemsPanelTemplate> </GroupStyle.Panel> </GroupStyle> </ListView.GroupStyle> </ListView> <ListView x:Name="ItemsGridView" Margin="118,-5,0,0" ItemsSource="{Binding Source={StaticResource AllCurrentGroup}}" SelectionMode="Single" Grid.Row="2" Grid.Column="0" ShowsScrollingPlaceholders="False" SelectionChanged="SelectedPresentationItem_SelectionChanged" IsSwipeEnabled="True"> <ListView.ItemsPanel> <ItemsPanelTemplate> <ItemsWrapGrid GroupHeaderPlacement="Left" Orientation="Vertical" /> </ItemsPanelTemplate> </ListView.ItemsPanel> <ListView.ItemTemplate> <DataTemplate> <StackPanel Grid.Column="1" Height="80" Margin="40,0,0,0" > <TextBlock Text="{Binding Tid }" Style="{StaticResource BodyTextBlockStyle}" Grid.Column="1" > <TextBlock.Foreground> <SolidColorBrush Color="{StaticResource Orange}"/> </TextBlock.Foreground> </TextBlock> <TextBlock Text="{Binding Titel }" Style="{StaticResource SubheaderTextBlockStyle}" Grid.Column="1" /> </StackPanel> </DataTemplate> </ListView.ItemTemplate> <ListView.GroupStyle> <GroupStyle> <GroupStyle.HeaderTemplate> <DataTemplate> <StackPanel Grid.Column="0" Grid.RowSpan="{Binding Rows}" Width="160" Height="200"> <StackPanel.Background> <SolidColorBrush Color="{StaticResource BlueDark}"/> </StackPanel.Background> <TextBlock Text="{Binding Vecka, Converter={StaticResource ToWeekString }}" Style="{StaticResource BodyTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,13,0,0"/> <TextBlock Text="{Binding Datum, Converter={StaticResource ToDayNumber }}" Style="{StaticResource HeaderTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" Margin="20,26,0,0"/> <TextBlock Text="{Binding Datum, Converter={StaticResource ToMonth }}" Style="{StaticResource SubheaderTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,-3,0,0"/> <TextBlock Text="{Binding Datum, Converter={StaticResource ToDayString }}" Style="{StaticResource BodyTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,13,0,0"/> </StackPanel> </DataTemplate> </GroupStyle.HeaderTemplate> <GroupStyle.Panel> <ItemsPanelTemplate> <WrapGrid Orientation="Vertical"></WrapGrid> </ItemsPanelTemplate> </GroupStyle.Panel> </GroupStyle> </ListView.GroupStyle> </ListView>

Answer 1:

http://code.msdn.microsoft.com/windowsapps/GroupedGridView-77c59e8e/sourcecode?fileId=44751&pathId=298223712

请参考上面的示例链接,可以帮助你实现你的REQ。



文章来源: Windows Store app, Listview Groupheaderplacement Left and vertical scrolling