// This is called when an item is dragged from the list of components to the viewport. The list view // item text should be the components name ("Name" from above), and its tag should be a new instance // of the component. public virtual ListViewItem SetupListViewItem(ListViewItem item, XComponent component) { //custom name ListViewItem.ListViewSubItem lvtype = new ListViewItem.ListViewSubItem(); lvtype.Name = "colName"; lvtype.Text = component.Name; //id ListViewItem.ListViewSubItem lvid = new ListViewItem.ListViewSubItem(); lvid.Name = "colID"; lvid.Text = component.ComponentID.ToString(); item.Text = component.ToString(); item.Name = component.ToString(); item.SubItems.Add(lvtype); item.SubItems.Add(lvid); return(item); }
public static void AddXComponentToSceneList(ListView Scene, XComponent component, string category) { ListViewItem item = new ListViewItem(); //custom name ListViewItem.ListViewSubItem lvtype = new ListViewItem.ListViewSubItem(); lvtype.Name = "colName"; lvtype.Text = component.Name; //id ListViewItem.ListViewSubItem lvid = new ListViewItem.ListViewSubItem(); lvid.Name = "colID"; lvid.Text = component.ComponentID.ToString(); item.Text = component.ToString(); item.Name = component.ToString(); item.SubItems.Add(lvtype); item.SubItems.Add(lvid); item.Group = Scene.Groups[category]; Scene.Items.Add(item); }