在我的wp8应用程序中,我显示了一些内容(例如图片)。我使用LongListSelector,并且在每个LLS的项目中都有ItemsControl和图像集合。我想在一行中显示两个图像,所以我使用wrappanel。但它会在usercontrol页面中的InitializeComponent()
行中引发XamlParseException。没有wrappanel一切正常。下面的代码ItemsControl.ItemsPanel中的Wrappanel抛出XamlParseException
<ItemsControl HorizontalAlignment="Center" ItemsSource="{Binding Vkontakte.Attachments.Photos}" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel Height="100" Width="100" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Image Margin="0,10,0,0" >
<Image.Source>
<BitmapImage UriSource="{Binding Src}" CreateOptions="BackgroundCreation" />
</Image.Source>
</Image>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
也许问题的情况下,即ItemsControl
在StackPanel
?
而例外是?内在的例外?堆栈跟踪?如果没有,我们所能做的只是猜测...... 1.您的xmlns for toolkit格式不正确2.在名称空间内定义的程序集未找到3.加载到设计器中的版本与传递到bin文件夹的版本不同。WrapPanel的构造函数抛出一个异常。前三个可以通过打开融合绑定并仔细检查运行时发生了什么来发现,最后通过将WrapPanel的构造函数中的断点附加到第一个Visual Studio实例。 – Will 2013-04-08 21:00:07