I am trying to use an Autocompletebox similar to a list view. I am doing this because of its compact form and look and feel. I am not using the Auto complete or suggestion options. I am using a separate dialog box to populate the control with data. I am also wanting use this control as an attachment manager. Something similar to the way outlook presents attachments.
Populating the control seems to be fairly easy. Although I would have expected a function to add to the internal collection rather than just an append method.
Here is how I am populating my AutoCompleteBox.
private void BuildCCList()
{
radCCList.Clear();
foreach(Contact curContact in m_objTicket.CCList)
{
radCCList.AppendText(curContact + ";");
}
}
This works pretty good; but, when I attempt to access those objects in the delete functions I have issues. I am not able to cast the item being deleted back to my Contact Class. It seems that the internal collection for the Autocompletebox is strings only. There seems to be a value field but I have not figured out how to set that.
((RadAutoCompleteBoxElement)this.radCCList.TextBoxElement).Items.CollectionChanged += Items_CollectionChanged;
private void Items_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Remove)
{
foreach(object objContact in e.NewItems)
{
Contact removeContact = (Contact)objContact;
m_objTicket.CCList.Remove(removeContact);
}
}
}
Is there any other way of populating the control that would allow me to add my custom objects to the internal list? Is there another control that I may be able to get a similar look and feel from? In the end I am looking for a compact list of objects that can be add to and deleted from with a minimal foot print on the form.
Any help would be appreciated.