I have a tool for displaying and editing PropertySets which was working well until we added a definition with a List data type. I can get the list but I need to show it in a DataTable. I define the column as a DataType.List but have been unable to figure out how to actually use it in the table. When I add it when filling the table it just shows up as (Collection) but I need it to show the actual PropertySet current value. I had also thought that by using the List datatype the list would be shown as a dropdown to select another item in the list.
To save the List column data I use a Dictionary since there may be mor than one column of this type:
var listDictionary
= new Dictionary
<string, List
<string>>();
As I loop through the definitions to create the columns I get the Name and the actual list of items:
case Autodesk.Aec.PropertyData.DataType.List:
var thelist = (AEC.ListDefinition)prop.ListDefinitionId.Open(OpenMode.ForRead);
var items = thelist.GetListItems();
var dataList
= new List
<string>(); foreach (ObjectId item in items)
{
var j = (AEC.ListItem)item.Open(OpenMode.ForRead);
dataList.Add(j.Name);
}
listDictionary.Add(prop.Name, dataList);
break;
Then, when I get the actual PropertySet data assigned to an object fill the table rows:
foreach (string s in GetPropDefs(property))
{
var d = propset.GetAt(propset.PropertyNameToId(s));
if (theTable
.Columns[s
].DataType == typeof(List
<string>)) {
List<string> dd = listDictionary[s];
row[s] = dd; //How to display the actual value of s which is a member of the list?
continue;
}
row[s] = d; //This works for DataTypes int, double, string, and bool
}
If I make the Column for the List as a string type, I can just assign the PropertySet Value, but then the list is ignored.
I'm drawing a blank on how to implement this. A Google search gives all kinds of answers on how to create the DataTable from a list but nothing on how to use a list with a DataType.List cell.