Created
August 19, 2011 04:06
-
-
Save andry1/1156010 to your computer and use it in GitHub Desktop.
flickr photo xaml databinding w/ templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Page | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | |
<Grid> | |
<Grid> | |
<Grid.Resources> | |
<XmlDataProvider x:Key="flickrdata" Source="http://api.flickr.com/services/feeds/photos_public.gne?tags=flower&lang=en-us&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> | |
<ItemsControl | |
Width="375" | |
ItemsSource="{Binding Mode=Default, Source={StaticResource flickrdata}, XPath=/rss/channel/item}" | |
ItemTemplate="{StaticResource itemTemplate}" | |
Template="{StaticResource controlTemplate}"> | |
</ItemsControl> | |
</Grid> | |
</Grid> | |
</Page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment