1 //----------------------------------------------------------------
2 // <copyright company="Microsoft Corporation">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //----------------------------------------------------------------
7 namespace System.Activities.Presentation.View.TreeView
10 using System.Activities.Presentation.Internal.PropertyEditing;
11 using System.Activities.Presentation.Model;
12 using System.Collections.Generic;
13 using System.Diagnostics.CodeAnalysis;
15 internal sealed class TreeViewItemKeyValuePairModelItemViewModel : TreeViewItemViewModel<KeyValuePair<ModelItem, ModelItem>>
17 public TreeViewItemKeyValuePairModelItemViewModel(TreeViewItemViewModel parent, KeyValuePair<ModelItem, ModelItem> value) : base(parent)
20 this.VisualValue = value;
24 this.InternalChildren.Add(TreeViewItemViewModel.DummyNode);
28 internal override void LoadChildren()
30 if (this.PerfEventProvider != null)
32 this.PerfEventProvider.DesignerTreeViewLoadChildrenStart();
36 if (this.Value.Value != null)
38 ChangeNotificationTracker tracker = this.Parent.GetTracker(this);
40 this.AddChild(TreeViewItemViewModel.CreateViewModel(this, this.Value.Value), tracker.ParentProperty);
43 if (this.PerfEventProvider != null)
45 this.PerfEventProvider.DesignerTreeViewLoadChildrenEnd();
49 internal override void UpdateChildren(ChangeNotificationTracker tracker, EventArgs e)
51 if (this.PerfEventProvider != null)
53 this.PerfEventProvider.DesignerTreeViewUpdateStart();
56 base.UpdateChildren(tracker, e);
58 if (this.Value.Value != null)
60 this.AddChild(TreeViewItemViewModel.CreateViewModel(this, this.Value.Value), tracker.ParentProperty);
63 if (this.PerfEventProvider != null)
65 this.PerfEventProvider.DesignerTreeViewUpdateEnd();
69 internal override void UpdateState()
72 if (this.Value.Value != null)
74 this.State |= TreeViewItemState.HasChildren;
78 protected override EditingContext GetEditingContext()
80 if (this.Value.Key != null)
82 return this.Value.Key.GetEditingContext();
86 return base.GetEditingContext();