In the current client I am using (control rather), the way to receive/parse a request is:
var result = (IDictionary<string, object>)e.GetResultData();
string id = result["id"].ToString();
string name = result["name"].ToString();
Dispatcher.BeginInvoke(() =>
{
id.ItemsSource = new List<String> {
id,
name};
}
XAML looks like:
<ListBox Height="168" HorizontalAlignment="Left" Margin="204,21,0,0" Name="id" VerticalAlignment="Top" Width="239" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Margin="2">
<TextBlock Text="{Binding}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
NEW UPDATE – FOR HELP (UNRESOLVED):
I am trying to use these strings so that I can put each item in a ListBox if more exist, opposed to just grabbing 1 item set (e.g. id, name, link).
public class Datum
{
public string id { get; set; }
public string name { get; set; }
public string link { get; set; }
}
Any help is beyond appreciated!
You need to set the
ItemsSourceas something that implementsIEnumerable.You also need to adjust your binding to take in the
DataContextsince you are not passing in an object.If you want to expand outside of a simple String create a class that will wrap your contents and then bind to the given property.
Then in your code behind you can create an instance and assign as before.
This is a simplistic example but should provide you with what you need.