私はこれらのクラスを持っています:
public class Datum
{
public string name{get;set;}
public string id{get;set}
public List<Brewery> breweries { get; set; }
.
.
}
public class Brewery
{
public string name { get; set; }
.
.
}
そして、このリストボックス
<ListBox ItemsSource="{Binding}" HorizontalAlignment="Left" Height="580" Margin="0,80,0,0" VerticalAlignment="Top" Width="446">
<ListBox.ItemTemplate>
<DataTemplate>
<ListBoxItem Tap="ListBoxItem_Tap" Tag="{Binding Path=id}">
<TextBlock Name="First" Text="{Binding Path=name}" />
<TextBlock Name="Second" Foreground="Gray" Text="{Binding Path=breweries.name}" />
</ListBoxItem>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
そこで、Datum オブジェクトのリストを作成し、リスト ボックスをそれにバインドします。そのようにして、最初のテキストブロックは Datum クラスのプロパティ 'name' にバインドされます。これは完全に機能します。私が欲しいのは、醸造所リストの最初の項目のプロパティ「名前」にバインドされる2番目のテキストブロックです。breweries が List でない場合は簡単に変更できますが、json から情報を取得しているため、変更できません。