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?