void m_objEditor_ItemSelected(object sender, EventArgs e) { RibbonSetControlledObject(null); XMLDescription.SetControlledObject(null); listBoxItems.SelectedIndexChanged -= listBoxItems_SelectionChanged; //listBoxItems.ClearSelected(); listBoxItems.SelectedIndex = -1; foreach (CGBaseItem item in m_objEditor.SelectedtItems) { if (item.isSelected) { listBoxItems.SelectedItems.Add(item); } } if (m_objEditor.SelectedtItems.Count == 1) { RibbonSetControlledObject(m_objEditor.SelectedtItems[0]); XMLDescription.SetControlledObject(m_objEditor.SelectedtItems[0]); } listBoxItems.SelectedIndexChanged += listBoxItems_SelectionChanged; }
void ctrlPreview_PreviewLeftButtonUp(object sender, EventArgs e) { XMLDescription.SetControlledObject(null); if (m_objEditor.SelectedtItems.Count == 1) { XMLDescription.SetControlledObject(m_objEditor.SelectedtItems[0]); } }
void m_objEditor_ItemsListUpdated(object sender, EventArgs e) { this.listBoxItems.SelectedIndexChanged -= listBoxItems_SelectionChanged; this.listBoxItems.Items.Clear();// = null; this.listBoxItems.Items.AddRange(m_objEditor.CGItems.ToArray()); //listBoxItems.DisplayMember = "ID"; //listBoxItems.ClearSelected(); listBoxItems.SelectedIndex = -1; for (int i = 0; i < m_objEditor.CGItems.Count; i++) { if (m_objEditor.CGItems[i].isSelected) { listBoxItems.SelectedItems.Add(m_objEditor.CGItems[i]); } } if (m_objEditor.SelectedtItems.Count == 1) { this.RibbonSetControlledObject(m_objEditor.SelectedtItems[0]); XMLDescription.SetControlledObject(m_objEditor.SelectedtItems[0]); } this.listBoxItems.SelectedIndexChanged += listBoxItems_SelectionChanged; }