Using a big collection - Windows 8 DataGrid

0

I am working on a Windows 8 Application (C#/XAML). One of the requirement is to load a collection of words in the DataGrid and we are using the Semantic Zoom option here.

When the collection has more than about 1500 items the application hangs and gives this error:

+Exception {"Not enough quota is available to process this command. (Exception from HRESULT: 0x80070718)"} System.Exception

Some of the code used:

_collection = _readDictionary.GetModeDetailsForModeDetails(modeId);

var query = from item in _collection
            orderby (item.WordName.ToLower())
            group item by item.WordName[0].ToString().ToUpper() into g
            select new { GroupName = g.Key.ToString().ToUpper(), Items = g };

foreach (var g in query)
{
  GroupInfoList<Words> info = new GroupInfoList<Words>();
  info.Key = g.GroupName;

  foreach (var item in g.Items)
  {
    info.Add(item);
  }

  groups.Add(info);
}

bindGroupData.Source = groups;
(semanticZoom.ZoomedOutView as ListViewBase).ItemsSource = bindGroupData.View.CollectionGroups;

and this is the XAML Code:

 <SemanticZoom  x:Name="semanticZoom" VerticalAlignment="Bottom" >
        <SemanticZoom.ZoomedOutView>
            <GridView ScrollViewer.IsHorizontalScrollChainingEnabled="False" VerticalAlignment="Top" HorizontalAlignment="Left">
                <GridView.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Group.Key}" FontFamily="Segoe UI Light" Foreground="Red" FontSize="24"/>
                    </DataTemplate>
                </GridView.ItemTemplate>
                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <WrapGrid ItemWidth="75" ItemHeight="75" MaximumRowsOrColumns="5" VerticalChildrenAlignment="Center" />
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>
                <GridView.ItemContainerStyle>
                    <Style TargetType="GridViewItem">
                        <Setter Property="Margin" Value="4" />
                        <Setter Property="Padding" Value="10" />
                        <Setter Property="BorderBrush" Value="Gray" />
                        <Setter Property="BorderThickness" Value="2" />
                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                        <Setter Property="VerticalContentAlignment" Value="Center" />
                    </Style>
                </GridView.ItemContainerStyle>
            </GridView>
            </SemanticZoom.ZoomedOutView>
        <SemanticZoom.ZoomedInView>
            <GridView x:Name="GrdViewWord" SelectionMode="Multiple" ItemsSource="{Binding Source={StaticResource bindGroupData}}"  ItemClick="GrdViewWord_ItemClick" SelectionChanged="GrdViewWord_SelectionChanged" Background="#FFE2E2E2" Height="396" VerticalAlignment="Top" >
                <!-- ItemContainerStyle="{StaticResource GridViewItemStyle}"   -->
                <GridView.ItemsPanel>
                    <ItemsPanelTemplate>
                        <!--<WrapGrid Orientation="Vertical"  Background="{Binding BG}"/>-->
                        <StackPanel Orientation="Horizontal" />
                    </ItemsPanelTemplate>
                </GridView.ItemsPanel>

                <GridView.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal" Height="20" Width="75"  >
                            <TextBlock Text="{Binding WordName}" Tag="{Binding WordID}" FontFamily="Segoe UI" FontSize="12" Margin="5,5,0,0" Foreground="Black" HorizontalAlignment="Left" Height="20" Padding="0"/>
                        </StackPanel>
                    </DataTemplate>
                </GridView.ItemTemplate>

                <GridView.GroupStyle>
                    <GroupStyle>
                        <GroupStyle.HeaderTemplate>
                            <DataTemplate>
                                <Grid Margin="10">
                                    <!--Background="{StaticResource ApplicationPageBackgroundThemeBrush}"-->
                                    <TextBlock Text='{Binding Key}'  FontSize="25" Foreground="Red" Margin="5" />
                                </Grid>
                            </DataTemplate>
                        </GroupStyle.HeaderTemplate>

                        <GroupStyle.Panel>
                            <ItemsPanelTemplate>
                                <VariableSizedWrapGrid Orientation="Vertical" Height="300" />
                            </ItemsPanelTemplate>
                        </GroupStyle.Panel>
                    </GroupStyle>
                </GridView.GroupStyle>
            </GridView>
        </SemanticZoom.ZoomedInView>
    </SemanticZoom>

Could anyone please help me with this issue?

c#
xaml
windows-8
datagrid
asked on Stack Overflow May 29, 2013 by Biju • edited May 29, 2013 by Nicolas Voron

3 Answers

0

Syncfusion providing the fastest Data Grid control for WinRT. It supports UI virtualization.

http://www.syncfusion.com/products/winrt/grid

answered on Stack Overflow May 29, 2013 by Jawahar
0

You have to use virtualization. GridView can easily be virtualized (UI virt. or Data virt.). see Microsoft Documentation to see what type of virtualization you need.

answered on Stack Overflow May 29, 2013 by Nicolas Voron
0

This seems to be a big issue with semantic zoom, anything over about 1200 items just does not work.

In the link above for 'Using virtualization with a list or grid' it says 'Grouped data - UI virtualization is not supported for grouped data.'

Semantic zoom uses grouped data so it does not work.

Even Microsoft's own semantic example crash with moiré than 1200 items.

this link may be useful:

http://social.msdn.microsoft.com/Forums/windowsapps/en-US/680136e1-67de-4111-824a-fa9f530ffc10/binding-largesets-of-data-to-gridview-is-causing-a-problem

answered on Stack Overflow Sep 4, 2013 by Andrew Bishop • edited Sep 4, 2013 by Andrew Bishop

User contributions licensed under CC BY-SA 3.0