public void Update() { _header.Text = string.Format("{0} ({1})", _value.SearchItem.Name, _hit); base.IsExpanded = this.Value.IsExpanded; foreach (var item in _listViewItemCollection.OfType <SearchTreeViewItem>().ToArray()) { if (!_value.Children.Any(n => object.ReferenceEquals(n, item.Value))) { _listViewItemCollection.Remove(item); } } foreach (var item in _value.Children) { if (!_listViewItemCollection.OfType <SearchTreeViewItem>().Any(n => object.ReferenceEquals(n.Value, item))) { var treeViewItem = new SearchTreeViewItem(item); treeViewItem.Parent = this; _listViewItemCollection.Add(treeViewItem); } } this.Sort(); }
public void Update() { _header.Text = string.Format("{0} ({1})", _value.SearchItem.Name, _hit); base.IsExpanded = this.Value.IsExpanded; foreach (var item in _listViewItemCollection.OfType<SearchTreeViewItem>().ToArray()) { if (!_value.Children.Any(n => object.ReferenceEquals(n, item.Value))) { _listViewItemCollection.Remove(item); } } foreach (var item in _value.Children) { if (!_listViewItemCollection.OfType<SearchTreeViewItem>().Any(n => object.ReferenceEquals(n.Value, item))) { var treeViewItem = new SearchTreeViewItem(item); treeViewItem.Parent = this; _listViewItemCollection.Add(treeViewItem); } } this.Sort(); }