public static IList <PropertyPageItem> GetListBoxItems() { var list = new List <PropertyPageItem>(_propertyPages.Count); var dic = new Dictionary <Guid, PropertyPageItem>(_propertyPages.Count); foreach (var kvp in _propertyPages) { var item = new PropertyPageItem(kvp.Value); dic.Add(kvp.Key, item); if (kvp.Value.GroupGuid != PropertyPageFactory.RootGroupGuid) { list.Add(item); } } foreach (var item in list) { PropertyPageItem parent; if (dic.TryGetValue(item.DataContext.GroupGuid, out parent)) { parent.Items.Add(item); parent.IsExpanded = true; dic.Remove(item.DataContext.Guid); } } list.Clear(); foreach (var kvp in dic) { list.Add(kvp.Value); } return(list); }
public static IList<PropertyPageItem> GetListBoxItems() { var list = new List<PropertyPageItem>(_propertyPages.Count); var dic = new Dictionary<Guid, PropertyPageItem>(_propertyPages.Count); foreach(var kvp in _propertyPages) { var item = new PropertyPageItem(kvp.Value); dic.Add(kvp.Key, item); if(kvp.Value.GroupGuid != PropertyPageFactory.RootGroupGuid) { list.Add(item); } } foreach(var item in list) { PropertyPageItem parent; if(dic.TryGetValue(item.DataContext.GroupGuid, out parent)) { parent.Items.Add(item); parent.IsExpanded = true; dic.Remove(item.DataContext.Guid); } } list.Clear(); foreach(var kvp in dic) { list.Add(kvp.Value); } return list; }