问题描述
我目前正在开发管理系统,我首先使用WPF的Microsoft默认数据网格,但是,由于它既没有分组功能,又没有过滤系统,因此我使用Xceed datagrid对其进行了更改。
问题是我找不到使用c#添加组合框列的任何方法。我尝试了一切,但没有任何效果。这是我的最后尝试:
for (int i = 0; i < this.DGV.Columns.Count; i++)
{
var Column = this.DGV.Columns[i];
if (Column.FieldName == "BranchGroupId")
{
System.Windows.FrameworkElementFactory comboBox = new System.Windows.FrameworkElementFactory(typeof(ComboBox));
comboBox.SetValue(ComboBox.ItemsSourceProperty,((ViewModel.BranchViewModel)this.DataContext).BranchesGroup_Collection);
comboBox.SetValue(ComboBox.DisplayMemberPathProperty,"Name");
comboBox.SetValue(ComboBox.SelectedValuePathProperty,"Id");
this.DGV.Columns[i].CellEditor = new Xceed.Wpf.DataGrid.CellEditor();
this.DGV.Columns[i].CellEditor.EditTemplate = new System.Windows.DataTemplate();
this.DGV.Columns[i].CellEditor.EditTemplate.VisualTree = comboBox;
}
}
请帮助
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)