I have a stack panel with multiple text blocks which are bound to parsed results from an XML file.
What I would like to is to make each results have an onlick event which would then link to more information or even a message.show box, but it must use a value from the results it displays.
This is the .Xaml section for the listbox which disaplys the results.)
<ListBox Height="435"
HorizontalAlignment="Left"
Name="TradeSearch1"
VerticalAlignment="Top"
Width="397"
Grid.ColumnSpan="3"
Margin="0,63,0,0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal"
Height="200">
<Image Source="{Binding ImageSource}"
Height="150" Width="150"
VerticalAlignment="Top"
Margin="0,10,8,0"/>
<StackPanel Width="370" >
<TextBlock Text="{Binding Title}"
TextWrapping="Wrap"
Foreground="#FFE51A1A"
FontSize="16" />
<TextBlock Text="{Binding PriceDisplay}"
TextWrapping="Wrap"
FontSize="20"
Foreground="Black" />
<TextBlock Text="{Binding ListingId}"
TextWrapping="Wrap"
FontSize="20"
Foreground="Black" />
<TextBlock Text="{Binding Region}"
TextWrapping="Wrap"
FontSize="18"
Foreground="Black" />
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
One of the text blocks returns a value for (ListingID). ideally when a user clicks this result they they will be taken to another page which will disaply more results based on the LIstingID form that results.
Listing ID is 400332970
Is there any way to carry that value to another page and use it in something like this? Where ListingID.XMl would be the listingId from the onClick result.
WebClient Trademe = new WebClient();
Trademe.DownloadStringCompleted += new DownloadStringCompletedEventHandler(Trademe_DownloadStringCompleted);
Trademe.DownloadStringAsync(new Uri("http://api.trademe.co.nz/v1/Listings/" + ListingID.xml));
I am sorry if this is confusing, I have tried to explain as best I can. Hopefully someone has an idea of what I am talking about.
If I understand it correctly, you could use a QueryString to pass the information along to the next page.
Then, in your
NewPage.xamlpage, you can read the value of the query string. (You can add error checks, or useQueryString.TryGetValueinstead to avoid exceptions).You can use
idas part of the download code you posted.