0
ListBox
があり、それがMyObject.MyCollection
にバインドされている場合、どうすればMyObject.MyValue
を得ることができますか?ListBoxコレクションの外部のバインディングプロパティ
<ListBox ItemsSource="{Binding Path=MyObject.MyCollection}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Path=Name}"/>
<TextBlock Text="{Binding Path=MyObject.MyValue}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
public class MyObject {
public ObservableCollection<CollectionThing> MyCollection {get; set;}
public string MyValue {get; set;}
}