private void DisplayAttributeGrid(TreeViewItem item) { grid.ItemsSource = null; if (item != null) { ROMNode node = (ROMNode)item.Tag; if (node != null) { List <ROMAttrData> table = new List <ROMAttrData>(); Dictionary <string, Dictionary <string, string> > allAttrs = node.GetAllAttributes(); SortedDictionary <string, KeyValuePair <string, Dictionary <string, string> > > sorted = new SortedDictionary <string, KeyValuePair <string, Dictionary <string, string> > >(); foreach (KeyValuePair <string, Dictionary <string, string> > kvp in allAttrs) { sorted.Add(kvp.Key, kvp); } foreach (string attr in sorted.Keys) { ROMAttrData row = new ROMAttrData(); Dictionary <string, string> attrValuePair = allAttrs[attr]; row.Attribute = attr; row.Value = attrValuePair["value"]; foreach (KeyValuePair <string, string> kvp in attrValuePair) { if (kvp.Key != "value") { if (row.SubValues == null) { row.SubValues = new ObservableCollection <string>(); } row.SubValues.Add(kvp.Key + ": " + kvp.Value); } } table.Add(row); } FillGrid(table); } } }
private void DisplayAttributeGrid(TreeViewItem item) { grid.ItemsSource = null; if (item != null) { ROMNode node = (ROMNode)item.Tag; if (node != null) { List<ROMAttrData> table = new List<ROMAttrData>(); Dictionary<string, Dictionary<string, string>> allAttrs = node.GetAllAttributes(); SortedDictionary<string, KeyValuePair<string, Dictionary<string, string>>> sorted = new SortedDictionary<string, KeyValuePair<string, Dictionary<string, string>>>(); foreach (KeyValuePair<string, Dictionary<string, string>> kvp in allAttrs) sorted.Add(kvp.Key, kvp); foreach (string attr in sorted.Keys) { ROMAttrData row = new ROMAttrData(); Dictionary<string, string> attrValuePair = allAttrs[attr]; row.Attribute = attr; row.Value = attrValuePair["value"]; foreach (KeyValuePair<string, string> kvp in attrValuePair) { if (kvp.Key != "value") { if (row.SubValues == null) row.SubValues = new ObservableCollection<string>(); row.SubValues.Add(kvp.Key + ": " + kvp.Value); } } table.Add(row); } FillGrid(table); } } }