简体   繁体   中英

Does ComboBox.Items.Add() trigger an event?

If I make a ComboBoxItem like this:
ComboBoxItem cbi = new ComboBoxItem();

Add a few properties to cbi , like Content and Tag.

And add that ComboBoxItem to a ComboBox like this:
cbxSelectClan.Items.Add(cbi);

Will cbxSelecteClan trigger any event ? (like SelectionChanged , TargetUpdated or any other possible event)

No, not by itself. You will need to bind the control to a collection that does provide such events, such as ObservableCollection . Maybe the following answer will help: Event firing when ComboBox.Items count changed?

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM