2009-05-22 4 views

答えて

1

ラップあなたは厄介な例外を取得して、ここでは動作しません

<ScrollViewer> 
    <WrapPanel> 
     <!-- your other controls here --> 
    </WrapPanel> 
</ScrollViewer> 
3

<ItemsControl.ItemsPanel> 
     <ItemsPanelTemplate> 
      <ScrollViewer> 
       <WrapPanel Orientation="Horizontal" /> 
      </ScrollViewer> 
     </ItemsPanelTemplate> 
    </ItemsControl.ItemsPanel> 

周りのScrollViewerのタグは、ItemsPanelTemplateの VisualTreeは、パネルが含まれている必要があります。 'System.Windows.Controls.ScrollViewer'はパネルではありません。

0

このサンプルでは、​​(Kaxamlサンプルから変更された)あなたを助ける必要があります。

<Page 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
    <Grid> 
    <Grid.Resources> 
     <XmlDataProvider x:Key="flickrdata" Source="http://api.flickr.com/services/feeds/photos_public.gne?tags=flower&amp;lang=en-us&amp;format=rss_200"> 
      <XmlDataProvider.XmlNamespaceManager> 
      <XmlNamespaceMappingCollection> 
       <XmlNamespaceMapping Prefix="media" Uri="http://search.yahoo.com/mrss/"/> 
      </XmlNamespaceMappingCollection> 
      </XmlDataProvider.XmlNamespaceManager> 
     </XmlDataProvider> 
     <DataTemplate x:Key="itemTemplate"> 
      <Image Width="75" Height="75" Source="{Binding Mode=OneWay, XPath=media:thumbnail/@url}"/> 
     </DataTemplate> 
     <ControlTemplate x:Key="controlTemplate" TargetType="{x:Type ItemsControl}"> 
      <WrapPanel IsItemsHost="True" Orientation="Horizontal"/> 
     </ControlTemplate> 
    </Grid.Resources> 
    <ScrollViewer Width="320" Height="225"> 
     <ItemsControl 
     Width="300" 
     ItemsSource="{Binding Mode=Default, Source={StaticResource flickrdata}, XPath=/rss/channel/item}" 
     ItemTemplate="{StaticResource itemTemplate}" 
     Template="{StaticResource controlTemplate}"> 
     </ItemsControl> 
    </ScrollViewer> 
</Grid> 
</Page> 
関連する問題