I have a collection of Database objects, each containing collections of Schema objects and User objects. I want to bind them to a TreeView, but adding
Here's a modification of Josh's solution to work with SMO (my original problem statement):
and the modified converter:
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
FolderNode[] result = new FolderNode[values.Length];
for (int i = 0; i < values.Length; ++i)
{
result[i].Items = (IEnumerable)values[i];
result[i].Name = values[i] is UserCollection ? "Users" : "Schemas";
}
return result;
}
Attribution Note: Content copied from OP's final solution, posted as an edit to the question, rather than as an answer