No, I doubt you tried WrapPanel. There are no WinRTs.
Using VariableSizedWrapGrid, you get the result something like this:

Using WrapGrid, you will get the result something like this:

Presto! Trick?
public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); } } public class MyViewModel { public MyViewModel() { var _Random = new Random((int)DateTime.Now.Ticks); var _Colors = typeof(Windows.UI.Colors) // using System.Reflection; .GetRuntimeProperties() .Select((c, i) => new { Title = c.Name, Color = (Windows.UI.Color)c.GetValue(null), ColSpan = _Random.Next(20, 300), RowSpan = _Random.Next(20, 300), }); this.Groups = new System.Collections.ObjectModel.ObservableCollection<object>(); this.Groups.Add(new { Title = "Mostly Red", Children = _Colors.Where(x => x.Color.R > 200) }); this.Groups.Add(new { Title = "Mostly Green", Children = _Colors.Where(x => x.Color.G > 200) }); this.Groups.Add(new { Title = "Mostly Blue", Children = _Colors.Where(x => x.Color.B > 200) }); } public System.Collections.ObjectModel.ObservableCollection<object> Groups { get; private set; } } <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> <Grid.DataContext> <local:MyViewModel /> </Grid.DataContext> <Grid.Resources> <CollectionViewSource x:Name="MyCsv" IsSourceGrouped="True" ItemsPath="Children" Source="{Binding Groups}" d:Source="{Binding Groups, Source={d:DesignInstance Type=local:MyViewModel, IsDesignTimeCreatable=True}}" /> </Grid.Resources> <GridView ItemsSource="{Binding Source={StaticResource MyCsv}}"> <GridView.GroupStyle> <GroupStyle> <GroupStyle.HeaderTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Rectangle Height="20" Width="20" Fill="{Binding Brush}" Margin="0,0,10,0" /> <TextBlock FontSize="40" Text="{Binding Title}" /> </StackPanel> </DataTemplate> </GroupStyle.HeaderTemplate> <GroupStyle.Panel> <ItemsPanelTemplate> <local:WrapPanel Orientation="Vertical" Width="2000" /> </ItemsPanelTemplate> </GroupStyle.Panel> </GroupStyle> </GridView.GroupStyle> <GridView.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" Margin="0,0,80,0" /> </ItemsPanelTemplate> </GridView.ItemsPanel> <GridView.ItemTemplate> <DataTemplate> <Grid Height="{Binding RowSpan}" Width="{Binding ColSpan}"> <Grid.Background> <SolidColorBrush Color="{Binding Color}" /> </Grid.Background> </Grid> </DataTemplate> </GridView.ItemTemplate> </GridView> </Grid>
But there is one. I am setting the width of the WrapPanel incorrectly. In the above code, by default I did not use it until 2000 (which is ridiculous). You will need to understand this part and post your decision here. (I can't do everything) Otherwise, this is what you are asking 100% for.
WinRT WrapPanel is on my blog http://jerrynixon.com (in the left column)
Good luck, Farhan.
See also: ms forum, where you asked the same message
source share