Amazon Search in XAML

I have just been playing with some XAML databinding. I was interested by the Channel 9 Example which creates an RSS reader in just a couple of lines of XAML

I hooked it up to Amazons REST API. I had a couple of problems with it that I will go into later. But what follows is the XAML that I used [also it can be downloaded from my server]:

xmlns="" xmlns:x="" Margin="10">
<XmlDataNamespaceManager x:Key="NS">
<XmlNamespace Prefix="a"
=" AWSECommerceService /2005-10-05" />
<XmlDataSource x:Key="Amazon" XmlNamespaceManager="{StaticResource NS}"
AssociateTag=cnetfra-21& AWSAccessKeyId=[SUBSCRIPTION ID]&
SearchIndex=Books& Keywords=AJAX& BrowseNode=71& ResponseGroup=Request,Large,Images& Sort=salesrank& Operation=ItemSearch"

<DataTemplate x:Key="TitleTemplate">
<TextBlock TextContent="{Binding XPath=a:ASIN}" />

<Label Content="{Binding Source={StaticResource Amazon}, XPath=/a:ItemSearchResponse/a:OperationRequest/ a:HTTPHeaders/a:Header/@Name}" FontSize="24" FontWeight="Bold" />

<DockPanel DataContext="{Binding Source={StaticResource Amazon},
Height="300px" >
<ListBox DockPanel.Dock="Left" Binding.XmlNamespaceManager="{StaticResource NS}"
ItemsSource="{Binding}" ItemTemplate="{StaticResource TitleTemplate}" IsSynchronizedWithCurrentItem="True" />
<TextBox Name="Contents" Text="{Binding XPath=a:ItemAttributes/a:Title}" Wrap="True" Width="Auto" />

The major problem that I had was that the AMAZON API has a default namespace, therefore to be able to use XPath against the datasource you need to include a NamespaceManager so that the XPath queries are resolved correctly. Once this is done everything is really simple.

Now this example I have created leaves a lot to be desired, but you can see how easy it to create.

Technorati Tags
[feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed], [feed]

Related Wikipedia Documents
, , , , , , , , , , , , ,

My Related Documents
, , , ,

Related Amazon Books
Programming Windows Presentation Foundation: /, Service-Oriented Architecture: Concepts, Technology, and Design: /, Service-oriented Architecture: A Field Guide to Integrating XML and Web Services: /, Mining Amazon Web Services: Building Applications with the Amazon API: /, Professional Web APIs with PHP: Google, EBay, Paypal, Amazon, Yahoo, Fedex: /, Amazon Hacks: /, MCAD Training Guide 70-320: Developing XML Web Services and Server Components with Visual C#.NET and the .NET Framework: /, Expert Service-Oriented Architecture in C#: Using the Web Services Enhancements 2.0: /, RSS and Atom Hacks: /, RSS and Atom: Understanding and Implementing Content Feeds and Syndication: /

Related Images From Flickr