各位高手:DataGridComboBoxColumn 的item 如何绑定 List<类>中的一个属性???
话不多说,直接上代码:
前台
<DataGridComboBoxColumn x:Name="ColDicEscape" Header="字典转义" Width="*" SelectedItemBinding="{Binding Path=ColDicEscape}" />
ColDicEscape.ItemsSource = DicHelper.getAllDicType();
public static List<DicEntity> getAllDicType() { List<DicEntity> myList = new List<DicEntity>(); //业务逻辑省略 return myList; }
public class DicEntity { public string DicKey; public string DicVal; public DicEntity(string _DicKey, string _DicVal) { DicKey = _DicKey; DicVal = _DicVal; } }