public WangStringOptionDataVM(SettingVM settingVM, ISetting setting, PropertyInfo property, PropertyInfo selector) : base(settingVM, setting, property) { try { var value = (string)property.GetValue(setting); List <TextObject> list = new List <TextObject>() { new TextObject("{=wang_selector_none}please select a item") }; _selectorIndex.Add(0, null); var selectedIndex = 0; var strs = selector.GetValue(setting); if (strs is IReadOnlyList <string> ) { var datas = (IReadOnlyList <string>)strs; for (int i = 0; i < datas.Count; i++) { var text = new TextObject(datas[i]); list.Add(text); _selectorIndex.Add(i + 1, text.GetID()); if (value == text.GetID()) { selectedIndex = i + 1; } } } else if (strs is Dictionary <string, TextObject> ) { var datas = (Dictionary <string, TextObject>)strs; for (int i = 0; i < datas.Count; i++) { list.Add(datas.ElementAt(i).Value); _selectorIndex.Add(i + 1, datas.ElementAt(i).Key); if (value == datas.ElementAt(i).Key) { selectedIndex = i + 1; } } } this._selector = new SelectorVM <SelectorItemVM>(list, selectedIndex, new Action <SelectorVM <SelectorItemVM> >(this.UpdateValue)); } catch (Exception e) { MessageBox.Show(e.FlattenException()); } }