1
我在我的WindowsPhone應用程序中使用FlipView有問題。 我有一個頁面與FlipView,其中有ItemsSource綁定到ItemsGroup和SelectedItem綁定到CurrentItem。 FlipView的DataTemplate包含WebView,它具有綁定到CurrentItem的Html的屬性Html。一切順利,但應用程序不時崩潰與System.ArgumentException不時,我不知道什麼是錯的。WindowPhone FlipView System.ArgumentException
XAML:
<Page
x:Class="UkraineNews.ItemPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:common="using:News.Common"
xmlns:viewModel="using:News.ViewModel"
xmlns:converter="using:News.Converter">
<Page.DataContext>
<viewModel:PhoneGroupViewModel/>
</Page.DataContext>
<Page.Resources>
<converter:DateConverter x:Key="DateConverter"
IsShowFullDate="True"/>
</Page.Resources>
<Grid>
<FlipView ItemsSource="{Binding Group.Items}"
SelectedItem="{Binding Group.CurrentItem, Mode=TwoWay}">
<FlipView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Grid.Row="0"
Background="{StaticResource ItemBorderBackground}"
HorizontalAlignment="Right"
Padding="5"
CornerRadius="0,0,0,5">
<TextBlock Text="{Binding Published, Converter={StaticResource DateConverter}}"/>
</Border>
<TextBlock Grid.Row="1"
TextWrapping="Wrap"
Text="{Binding Title}"
FontWeight="Bold"
Margin="24,0"
FontSize="20"
Foreground="{StaticResource LeftMenuBackgroundBrush}"/>
<WebView Grid.Row="2"
NavigationStarting="WebView_NavigationStarting"
common:WebViewBehaviour.Html="{Binding Html}"/>
</Grid>
</DataTemplate>
</FlipView.ItemTemplate>
</FlipView>
</Grid>
C#:
public class NewsItem
{
public string Title { get; set; }
public string Link { get; set; }
public DateTime Published { get; set; }
public string Html { get; set; }
public string Image { get; set; }
}
錯誤:
The parameter is incorrect. System.ArgumentException: Value does not fall within the expected range.
我正在觀察同樣的行爲。我認爲當用戶與控件交互時添加項目時,這是flipview中的一個錯誤。不能悲傷地重現或找到錯誤。 – 2014-12-28 14:44:47
看起來問題是在FlipView的默認模板中有2.5分的邊距,但我不知道這與這個問題有什麼關係。我已經刪除了他們,問題沒有了。 – 2014-12-28 16:48:40
您可以擴展您的解決方案嗎? – 2014-12-31 09:55:17