protected virtual void CreateVertexControl(TVertex vertex) { VertexControl presenter; var compoundGraph = Graph as ICompoundGraph <TVertex, TEdge>; if (IsCompoundMode && compoundGraph != null && compoundGraph.IsCompoundVertex(vertex)) { var compoundPresenter = new CompoundVertexControl { Vertex = vertex, DataContext = vertex }; compoundPresenter.Expanded += CompoundVertexControl_ExpandedOrCollapsed; compoundPresenter.Collapsed += CompoundVertexControl_ExpandedOrCollapsed; presenter = compoundPresenter; } else { // Create the Control of the vertex presenter = new VertexControl { Vertex = vertex, DataContext = vertex }; } //var presenter = _vertexPool.GetObject(); //presenter.Vertex = vertex; _vertexControls[vertex] = presenter; presenter.RootCanvas = this; if (IsCompoundMode && compoundGraph != null && compoundGraph.IsChildVertex(vertex)) { var parent = compoundGraph.GetParent(vertex); var parentControl = GetOrCreateVertexControl(parent) as CompoundVertexControl; Debug.Assert(parentControl != null); parentControl.Vertices.Add(presenter); } else { //add the presenter to the GraphLayout Children.Add(presenter); } //Measuring & Arrange presenter.InvalidateMeasure(); SetHighlightProperties(vertex, presenter); RunCreationTransition(presenter); }
private void SetHighlightProperties(TVertex vertex, VertexControl presenter) { object highlightInfo; if (IsHighlightedVertex(vertex, out highlightInfo)) { GraphElementBehaviour.SetIsHighlighted(presenter, true); GraphElementBehaviour.SetHighlightInfo(presenter, highlightInfo); } object semiHighlightInfo; if (IsSemiHighlightedVertex(vertex, out semiHighlightInfo)) { GraphElementBehaviour.SetIsSemiHighlighted(presenter, true); GraphElementBehaviour.SetSemiHighlightInfo(presenter, semiHighlightInfo); } }