0
我试图将列表绑定到WPF中的组合框,但我没有得到我期望/需要的东西。 这是在我的ViewModel
:将对象属性映射到WPF中的comboxbox mvvm
public ICollection<FileType> FileTypes { get; private set; }
这是我的文件类型类:
public class FileType
{
public string Description { get; set; }
public string Code { get; set; }
public ICollection<FileAction> FileActions { get; set; }
}
这就是我是如何结合我的组合框:
<ComboBox Name="uxFileTypeBox" Grid.Row="1" Grid.Column="1"
Margin="10,10,10,10" Grid.ColumnSpan="2"
ItemsSource="{Binding FileTypes}" SelectedItem="{Binding SelectedFileType}"/>
组合框显示该对象而不是它的描述,我怎样才能让ComboBox显示Description属性,并且如果可能的话使用Code属性作为值。
注:我使用的工具包MVVM光