Hi All, I have created a dynamic pivot in which the data is binded through a list in which the data changes randomly almost the range is between 100 - 150 entries in the list . All goes well the data get added to the list but when the data is binded the app terminates unexpectedly and show the out of memory exception My code is somehow like this xaml
<Controls:Pivot x:Name="pvtDeals" Background="Gray" ItemsSource="{Binding CityItemList}" Grid.Row="1"> <Controls:Pivot.ItemTemplate> <DataTemplate> <Grid > <Grid.RowDefinitions> <RowDefinition Height="200"/> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Image x:Name="imgDeal" Tag="0" Source="{Binding ImageLink}" Stretch="Uniform" HorizontalAlignment="Stretch" /> <TextBlock Foreground="Red" Text="{Binding Title}" Grid.Row="1" TextWrapping="Wrap"/> <ScrollViewer Grid.Row="2"> <TextBlock Foreground="Black" Text="{Binding Description}" TextWrapping="Wrap" Grid.Row="2"/> </ScrollViewer> </Grid> </DataTemplate> </Controls:Pivot.ItemTemplate> </Controls:Pivot>
<pre lang="c#">var xml = XDocument.Parse(e.Result); // from XML string, e.g.: <xml ...><persons><person>... // SaveDealInfoToIsolatedStorage(e.Result); System.Text.RegularExpressions.Regex rx = new System.Text.RegularExpressions.Regex("<[^>]*>"); var Channel = xml.Root.Elements("channel").ToList(); var items = Channel[0].Elements("item").ToList(); App.MainViewModel.CityItemList.Clear(); foreach (var item in items) { App.MainViewModel.CityItemList.Add(new Model.CityItems { Title = item.Element("title").Value, Description = rx.Replace(item.Element("description").Value.Replace("\"", string.Empty), string.Empty), ImageLink = item.Element("imageURL").Value,//image, WebLink = item.Element("link").Value }); System.Diagnostics.Debug.WriteLine(App.MainViewModel.CityItemList.Count.ToString()); }</person></persons>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)