![](/img/trans.png)
[英]ItemsControl with WrapPanel as ItemsPanel - combine a “static” child and ItemsSource
[英]Wrappanel in ItemsControl.ItemsPanel throws XamlParseException
在我的wp8應用程序中,我顯示了一些內容(例如圖像)。 我使用LongListSelector,並且在每個LLS的項目中都有帶有圖像集合的ItemsControl。 我想在一行中顯示兩個圖像,所以我使用了一個包裝面板。 但是它在用戶控件頁面的InitializeComponent()
行中引發XamlParseException。 沒有wrappanel,一切正常。 這里的代碼
<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
?
由於您的ItemsSource綁定而引發的異常。 如果Vkontakte不是您的數據上下文上的對象,則您可能需要查看要綁定的對象。 它必須是某種對象的集合。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.