我对绑定源dataGridView中的组合框有疑问。我的问题是我的文档有两个项目,a3_Liggend和a4_Liggend。它显示了组合框中的名字,很好,但是下拉列表为空,并且在组合框中添加新行时显示了名称a4_Liggend。我不知道出了什么问题。也许很简单?
谢谢!
这是我获取信息的方式。我在Autodesk Revit中使用此代码:
public class LevelResource
{
string m_dataName;
int m_iD;
public String Name
{
get
{
return m_dataName;
}
set
{
m_dataName = value;
}
}
public int Id
{
get
{
return m_iD;
}
set
{
m_iD = value;
}
}
}
try
{
t.Start("filter");
getElement = new SortableBindingList<LevelResource>();
FilteredElementCollector collector = new FilteredElementCollector(doc);
List<ViewSheet> views = collector.OfClass(typeof(ViewSheet))
.OfType<ViewSheet>().OrderBy(lev => lev.SheetNumber).ToList();
{
IList<Element> genericSymbolsNamedTest = new FilteredElementCollector(doc)
.OfClass(typeof(FamilySymbol))
.OfCategory(BuiltInCategory.OST_TitleBlocks)
.ToElements();
foreach (FamilySymbol fs in genericSymbolsNamedTest)
{
LevelResource dataInRow2 = new LevelResource();
dataInRow2.Name = fs.Name;
dataInRow2.Id = fs.Id.IntegerValue;
getElement.Add(dataInRow2);
}
using (LevelView displayForm = new LevelView(this))
{
displayForm.ShowDialog();
}
t.Commit();
return Result.Succeeded;
}
public SortableBindingList<LevelResource> getElement;
/// <summary>
/// Store all levels' datum in system
/// </summary>
public SortableBindingList<LevelResource> FoundElements
{
get
{
return getElement;
}
set
{
getElement = value;
}
}