private void VisualValue_PropertyChanged(object sender, ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName.Equals("IsSelection")) { this.IsHighlighted = Selection.IsSelection(this.VisualValue); if (this.IsHighlighted) { this.ExpandToNode(); } } else if (e.PropertyName.Equals("IsPrimarySelection")) { if (TreeViewItem == null) { // TreeViewItem is not initialized at the first time of SelectionChanged by WorkflowViewElement.OnGotFocusEvent. return; } bool isPrimarySelection = Selection.IsPrimarySelection(this.VisualValue); if (isPrimarySelection) { TreeViewItem.Select(); } else { TreeViewItem.Unselect(); } } }
void modelItem_PropertyChanged(object sender, ComponentModel.PropertyChangedEventArgs e) { if (!IsTrackedNodeAlive) { return; } ModelItem modelItem = sender as ModelItem; if (modelItem != null) { HashSet <string> propertyList = null; if (TrackedModelItem.TryGetValue(modelItem, out propertyList)) { if (propertyList.Contains(e.PropertyName)) { this.UpdateChildren(e); } } } }