【发布时间】:2014-11-26 03:25:34
【问题描述】:
我在 wpf 中有一个组合框,它绑定到 List<string>。一切正常,但现在由于某种原因我需要绑定到项目模板。组合框的 XAML 是
<ComboBox ItemsSource="{Binding Tracks}" SelectedItem="{Binding SelectedTrack}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding **WhatShouldBeHere**}"></TextBlock>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
如果我的数据源是自定义集合,那么绑定很容易,我应该只从自定义集合中传递属性名称,但是由于绑定源是字符串列表,那么绑定属性应该是什么?
【问题讨论】:
标签: wpf xaml data-binding combobox