我正在使用枢轴控制来根据以下XAML设计滑动一些文章(例如:20)
<Page
x:Class="NAMESPACE.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:NAMESPACE"
xmlns:ViewModels="using:NAMESPACE.ViewModels"
xmlns:common="using:NAMESPACE.Classes"
xmlns:stringBind="using:NAMESPACE.Classes"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:q42controls="using:Q42.WinRT.Controls"
xmlns:UI="using:Microsoft.Advertising.WinRT.UI"
Background="Gray"
mc:Ignorable="d">
<Page.Resources>
<ViewModels:ArticleViewModel x:Key="ViewModel" />
<DataTemplate x:Key="headerTest">
</DataTemplate>
<DataTemplate x:Key="pivotTemplate">
<StackPanel Margin="-15 0 -15 0">
<Grid>
<Image x:Name="PlaceHolderImage" Source="Assets/PlaceHolder.jpg"></Image>
<Image q42controls:ImageExtensions.CacheUri="{Binding ImageURL}" Tag="{Binding ImageURL}" Tapped="ImageView"></Image>
</Grid>
<StackPanel Background="Black">
<TextBlock Text="{Binding UpdatedDate}" FontSize="15" HorizontalAlignment="Center"
VerticalAlignment="Center" Pivot.SlideInAnimationGroup="GroupTwo" Margin="10 10 0 10"
FontFamily="{StaticResource ContentControlThemeFontFamily}"
Foreground="#777"></TextBlock>
<Border VerticalAlignment="Bottom" Height="1" Background="Black" Opacity="0.1">
</Border>
<RichTextBlock x:Name="HeadLine" local:Properties.Html="{Binding HeadLine}"
Margin="10 5 10 -5" TextWrapping="Wrap"
FontSize="{Binding HeadlineFontSize}" Foreground="White"
FontFamily="{StaticResource HeadlineCommonFamiy}"
Pivot.SlideInAnimationGroup="GroupTwo"
IsTextSelectionEnabled="True"/>
<RichTextBlock local:Properties.Html="{Binding Abstract}" TextWrapping="Wrap" FontSize="{Binding AbstractFontSize}"
Pivot.SlideInAnimationGroup="GroupTwo" Margin="10 5 10 10"
Foreground="#999"
FontFamily="{StaticResource AbstractCommonFamily}"
IsTextSelectionEnabled="True"/>
</StackPanel>
<StackPanel x:Name="descriptionSP" Background="Black">
<Image Source="Assets/PlaceHolder.jpg" Width="300" Height="250"></Image>
<UI:AdControl
AutoRefreshIntervalInSeconds="60"
ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"
AdUnitId="10865270"
HorizontalAlignment="Center"
Height="250"
IsAutoRefreshEnabled="True"
VerticalAlignment="Top"
Margin="5,-240,5,5"
Width="300"/>
<RichTextBlock IsTextSelectionEnabled="True" x:Name="richTextBlock"
local:Properties.Html="{Binding ArticleDetail}" TextWrapping="Wrap"
FontSize="{Binding FontSize}" Foreground="White"
Pivot.SlideInAnimationGroup="GroupTwo" Margin="10,10,10,-20"
FontFamily="{StaticResource ContentControlThemeFontFamily}">
</RichTextBlock>
<Image Source="Assets/PlaceHolder.jpg" Width="300" Height="250"></Image>
<UI:AdControl
AutoRefreshIntervalInSeconds="60"
ApplicationId="3f83fe91-d6be-434d-a0ae-7351c5a997f1"
AdUnitId="10865270"
HorizontalAlignment="Center"
Height="250"
IsAutoRefreshEnabled="True"
VerticalAlignment="Top"
Margin="5,-220,5,5"
Width="300"/>
<WebView x:Name="criticWebView" Visibility="{Binding WebViewVisibility}" Height="300"
Source="{Binding CriticReviewUrl}" />
</StackPanel>
</StackPanel>
</DataTemplate>
</Page.Resources>
<Page.BottomAppBar>
<CommandBar Foreground="White" Background="Black">
<CommandBar.PrimaryCommands>
<AppBarButton x:Uid="Share" Foreground="White" Click="Share_Click" Label="Share">
<AppBarButton.Icon>
<BitmapIcon Foreground="White" UriSource="/Assets/Share.png" Height="30" Margin="0,-5,0,0"/>
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Icon="Favorite" Foreground="White" Name="favIcon" Click="Favorite_Click" Label="Favorite" Margin="0,-2,0,0"></AppBarButton>
<AppBarButton Icon="Setting" Foreground="White" Name="Settings" Click="Settings_Click" Label="Settings" Margin="0,-2,0,0"></AppBarButton>
</CommandBar.PrimaryCommands>
</CommandBar>
</Page.BottomAppBar>
<Grid Background="Black" x:Name="grid">
<Grid x:Name="LoadingGrid" Visibility="Visible">
<ProgressRing x:Name="progressRing" IsActive="True" Foreground="#d03438" HorizontalAlignment="Center" Width="60"
Height="50" VerticalAlignment="Center" Margin="0 20 0 0"></ProgressRing>
</Grid>
<Grid x:Name="mainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Image x:Name="logoImage" Grid.Row="0" Source="Assets/Maalaimalar_logo.png" HorizontalAlignment="Center" Margin="1 5 0 0"></Image>
<ScrollViewer x:Name="swipeBetweenPages" Grid.Row="1" Visibility="Collapsed">
<Pivot DataContext="{StaticResource ViewModel}" x:Name="pivot" Margin="0,-45,0,0"
HeaderTemplate="{StaticResource headerTest}"
ItemTemplate="{StaticResource pivotTemplate}" ItemsSource="{Binding Articles}" SelectionChanged="pivot_SelectionChanged">
</Pivot>
</ScrollViewer>
</Grid>
<Grid Visibility="Collapsed" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Black" Name="popUp">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Image Source="/Assets/Close_White.png" HorizontalAlignment="Right" Grid.Row="1" Tapped="CloseImage"
VerticalAlignment="Top" Margin="0,30,0,0" Height="30"></Image>
<ScrollViewer x:Name="scroll" ZoomMode="Enabled" Grid.Row="2">
<Image x:Name="popUpImage" VerticalAlignment="Center" Margin="0,-50,0,0"></Image>
</ScrollViewer>
</Grid>
</Grid>
</Page>
以下是将数据绑定到XAML
的代码data = e.Parameter as Feed;
feedList = data.Articles;
localSettings.Values["ChildName"] = feedList[0].ChildName;
for (int z = 0; z < feedList.Count; z++)
{
string articleDetail = WebUtility.HtmlDecode(feedList[z].ArticleDetail);
articleDetail = articleDetail.Replace("<[^>]*>", Environment.NewLine);
articleDetail = articleDetail.Replace("<div><br /></div>", "<br /><br />");
feedList[z].ArticleDetail = articleDetail;
if (feedList[z].ChildName == "Review")
{
feedList[z].WebViewVisibility = "Visible";
feedList[z].CriticReviewUrl = feedList[z].CriticReviewUrl.Replace("Review", "CriticReviewMobile");
feedList[z].CriticReviewUrl = Constants.Constants.BaseUrl.CriticUrl + feedList[z].CriticReviewUrl;
}
else
feedList[z].WebViewVisibility = "Collapsed";
}
index = data.ListingIndex + 1;
if (index > feedList.Count - 1)
{
index = 0;
}
if (index == 0)
{
index = feedList.Count;
}
List<Article> feedList1 = new List<Article>();
feedList1.Add(feedList[index - 1]);
int j = index;
for (int i = 0; i < feedList.Count - 1; i++)
{
if (j >= feedList.Count)
{
j = 0;
}
feedList1.Add(feedList[j]);
j++;
}
feedList = feedList1;
var viewModel = pivot.DataContext as ArticleViewModel;
viewModel.BindListToView(feedList);
LoadingGrid.Visibility = Visibility.Collapsed;
swipeBetweenPages.Visibility = Visibility.Visible;
在滑动时,应用会在5次或更少次扫描后因任何异常而崩溃。我已将曲棍球应用程序添加到我的应用程序中,但崩溃报告中也没有处理崩溃。
请帮我解决问题..