我有一些图标应该显示在 RowObject 名称旁边的第一列中。不同的图片与不同类型的对象相关。这部分代码使用我需要的对象创建列。
this.descriptionTView = new BrightIdeasSoftware.TreeListView();
this.descriptionTView.CanExpandGetter = x =>
{
if ( ( x as ITreeViewItem ).Items != null )
{
return ( x as ITreeViewItem ).Items.Length > 0;
}
else
{
return false;
}
};
this.descriptionTView.ChildrenGetter = x => ( x as ITreeViewItem ).Items;
var column1 = new BrightIdeasSoftware.OLVColumn( "", "Part0" );
column1.AspectGetter = x => ( x as ITreeViewItem ).Part0;
column1.IsEditable = true;
var column2 = new BrightIdeasSoftware.OLVColumn( "", "Part1" );
column2.AspectGetter = x => ( x as ITreeViewItem ).Part1;
column1.IsEditable = true;
column2.IsEditable = true;
this.descriptionTView.Columns.Add( column1 );
this.descriptionTView.Columns.Add( column2 );
private List<ITreeViewItem> itemsList;
descriptionTView.Roots = itemsList;