I have an editable comboxbox bound to a List in a Winform application.
public class Address
{
public string DisplayText { get; set; }
public string DropDownText { get; set; }
}
I want to display DropDownText when user expands the combobox, but I want show the DisplayText as Combobox's text after user has selected the dropdown item.
I can do this in WPF by using TextSearch.SetTextPath property. Is it possible in Winforms?
Found the answer:
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{
var value = comboBox1.SelectedValue.ToString();
BeginInvoke(new MethodInvoker(delegate()
{
comboBox1.Text = value;
}));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.