diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml index 3295f4896c..a74944e576 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml @@ -14,10 +14,11 @@ - + + + + + @@ -33,14 +34,6 @@ - diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs index d0dd8a1f7d..7d6db2b99c 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Drawing/PositionedGraphNodeControl.xaml.cs @@ -48,19 +48,22 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing // shown in the ListView private ObservableCollection items = new ObservableCollection(); - private ContentNode root; /// /// The tree to be displayed in this Control. /// - public ContentNode Root + public ContentNode Root { get; set; } + + /// + /// Sets the node to be displayed by this control. + /// + /// + public void SetDataContext(PositionedNode node) { - get { return this.root; } - set { - this.root = value; - this.items = GetInitialItems(this.root); - // data virtualization, ContentPropertyNode implements IEvaluate - this.listView.ItemsSource = new VirtualizingObservableCollection(this.items); - } + this.DataContext = node; + this.Root = node.Content; + this.items = GetInitialItems(this.Root); + // data virtualization, ContentPropertyNode implements IEvaluate + this.listView.ItemsSource = new VirtualizingObservableCollection(this.items); } public void CalculateWidthHeight() @@ -72,13 +75,13 @@ namespace Debugger.AddIn.Visualizers.Graph.Drawing listView.Width = gv.Columns[0].Width + gv.Columns[1].Width + gv.Columns[2].Width + 10; int maxItems = 10; - listView.Height = Math.Min(this.items.Count, maxItems) * 20; + listView.Height = 4 + Math.Min(this.items.Count, maxItems) * 20; if (this.items.Count > maxItems) { listView.Width += 30; // for scrollbar } this.Width = listView.Width + 2; - this.Height = listView.Height + 2; + this.Height = listView.Height + this.typeNameHeaderBorder.Height + 2; } public PositionedGraphNodeControl() diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/PositionedNode.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/PositionedNode.cs index d167dd507a..8917cfaba6 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/PositionedNode.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/PositionedNode.cs @@ -19,10 +19,11 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout /// Creates new PositionedNode. /// /// Underlying ObjectNode. - public PositionedNode(ObjectGraphNode objectNode) + public PositionedNode(ObjectGraphNode objectNode, Expanded expanded) { - this.objectNode = objectNode; + this.ObjectNode = objectNode; InitVisualControl(); + InitContentFromObjectNode(expanded); } public event EventHandler PropertyExpanded; @@ -30,20 +31,21 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout public event EventHandler ContentNodeExpanded; public event EventHandler ContentNodeCollapsed; - private ObjectGraphNode objectNode; /// /// Underlying ObjectNode. /// - public ObjectGraphNode ObjectNode - { - get { return objectNode; } - } + public ObjectGraphNode ObjectNode { get; private set; } /// /// Tree-of-properties content of this node. /// public ContentNode Content { get; set; } + /// + /// Name of the Type in the debuggee. + /// + public string TypeName { get { return this.ObjectNode.TypeName; } } + /// /// The size of the subtree of this node in the layout. /// @@ -54,14 +56,14 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout /// public PositionedGraphNodeControl NodeVisualControl { get; private set; } - public void InitContentFromObjectNode(Expanded expanded) + void InitContentFromObjectNode(Expanded expanded) { this.Content = new ContentNode(this, null); this.Content.InitOverride(this.ObjectNode.Content, expanded); - this.NodeVisualControl.Root = this.Content; + this.NodeVisualControl.SetDataContext(this); } - private void InitVisualControl() + void InitVisualControl() { this.NodeVisualControl = NodeControlCache.Instance.GetNodeControl(); // propagate events from nodeVisualControl diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/TreeLayout.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/TreeLayout.cs index baa503c06f..e6eeda03b0 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/TreeLayout.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/Layout/Tree/TreeLayout.cs @@ -53,8 +53,7 @@ namespace Debugger.AddIn.Visualizers.Graph.Layout // create empty PositionedNodes foreach (ObjectGraphNode objectNode in objectGraph.ReachableNodes) { - var posNode = new PositionedNode(objectNode); - posNode.InitContentFromObjectNode(expanded); + var posNode = new PositionedNode(objectNode, expanded); posNode.MeasureVisualControl(); positionedGraph.AddNode(posNode); positionedNodeFor[objectNode] = posNode; diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs index 36f84e00d4..edf0a95862 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphBuilder.cs @@ -303,6 +303,7 @@ namespace Debugger.AddIn.Visualizers.Graph private ObjectGraphNode createNewNode(Value permanentReference, Expression expression) { ObjectGraphNode newNode = new ObjectGraphNode(); + newNode.TypeName = permanentReference.Type.Name; newNode.HashCode = permanentReference.InvokeDefaultGetHashCode(); resultGraph.AddNode(newNode); diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphNode.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphNode.cs index 62fd5bed2d..d2dc8c064c 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphNode.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraph/ObjectGraphNode.cs @@ -32,17 +32,16 @@ namespace Debugger.AddIn.Visualizers.Graph /// /// Property tree of this node. /// - public ThisNode Content - { - get; set; - } + public ThisNode Content { get; set; } + + /// + /// Name of the Type in the debuggee. + /// + public string TypeName { get; set; } public IEnumerable Properties { - get - { - return this.Content.FlattenPropertyNodes().Select(node => {return node.Property; }); - } + get { return this.Content.FlattenPropertyNodes().Select(node => {return node.Property; }); } } } }