Table of Contents

Class Diagram

Namespace
H.Controls.Diagram
Assembly
H.Controls.Diagram.dll
[TemplatePart(Name = "NodeLayer", Type = typeof(NodeLayer))]
[TemplatePart(Name = "LinkLayer", Type = typeof(LinkLayer))]
[TemplatePart(Name = "DynamicLayer", Type = typeof(LinkLayer))]
public class Diagram : ContentControl, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChild, IDiagram
Inheritance
Diagram
Implements
Inherited Members
Extension Methods

Constructors

Diagram()

public Diagram()

Fields

AddLinkedRoutedEvent

public static readonly RoutedEvent AddLinkedRoutedEvent

Field Value

RoutedEvent

AddNodedRoutedEvent

public static readonly RoutedEvent AddNodedRoutedEvent

Field Value

RoutedEvent

DataSourceProperty

public static readonly DependencyProperty DataSourceProperty

Field Value

DependencyProperty

DynamicLinkStyleProperty

public static readonly DependencyProperty DynamicLinkStyleProperty

Field Value

DependencyProperty

ItemsChangedRoutedEvent

public static readonly RoutedEvent ItemsChangedRoutedEvent

Field Value

RoutedEvent

LayoutProperty

public static readonly DependencyProperty LayoutProperty

Field Value

DependencyProperty

LinkDrawerProperty

public static readonly DependencyProperty LinkDrawerProperty

Field Value

DependencyProperty

LinkStyleProperty

public static readonly DependencyProperty LinkStyleProperty

Field Value

DependencyProperty

MessageProperty

public static readonly DependencyProperty MessageProperty

Field Value

DependencyProperty

NodeStyleProperty

public static readonly DependencyProperty NodeStyleProperty

Field Value

DependencyProperty

SelectedNodeProperty

public static readonly DependencyProperty SelectedNodeProperty

Field Value

DependencyProperty

SelectedPartChangedRoutedEvent

public static readonly RoutedEvent SelectedPartChangedRoutedEvent

Field Value

RoutedEvent

SelectedPartProperty

public static readonly DependencyProperty SelectedPartProperty

Field Value

DependencyProperty

UseAutoAddLinkOnEndProperty

public static readonly DependencyProperty UseAutoAddLinkOnEndProperty

Field Value

DependencyProperty

Properties

DataSource

public IDiagramDataSource DataSource { get; set; }

Property Value

IDiagramDataSource

DefaultKey

public static ComponentResourceKey DefaultKey { get; }

Property Value

ComponentResourceKey

DynamicLayer

[Browsable(false)]
public LinkLayer DynamicLayer { get; }

Property Value

LinkLayer

DynamicLinkStyle

[Browsable(false)]
public Style DynamicLinkStyle { get; set; }

Property Value

Style

Layout

[Display(Name = "布局方式", GroupName = "显示设置")]
public ILayout Layout { get; set; }

Property Value

ILayout

LinkDrawer

[Browsable(false)]
public ILinkDrawer LinkDrawer { get; set; }

Property Value

ILinkDrawer

LinkLayer

[Browsable(false)]
public LinkLayer LinkLayer { get; }

Property Value

LinkLayer

LinkStyle

[Browsable(false)]
public Style LinkStyle { get; set; }

Property Value

Style

LinkTemplate

[Browsable(false)]
public DataTemplate LinkTemplate { get; set; }

Property Value

DataTemplate
[Browsable(false)]
public List<Link> Links { get; }

Property Value

List<Link>

Message

[Browsable(false)]
public string Message { get; set; }

Property Value

string

NodeLayer

[Browsable(false)]
public NodeLayer NodeLayer { get; }

Property Value

NodeLayer

NodeStyle

[Browsable(false)]
public Style NodeStyle { get; set; }

Property Value

Style

Nodes

[Browsable(false)]
public List<Node> Nodes { get; }

Property Value

List<Node>

SelectedNode

[Display(Name = "选中节点", GroupName = "显示设置")]
public Node SelectedNode { get; set; }

Property Value

Node

SelectedPart

[Display(Name = "选中部位", GroupName = "显示设置")]
public Part SelectedPart { get; set; }

Property Value

Part

UseAnimation

[Display(Name = "启用切换布局动画", GroupName = "显示设置")]
public bool UseAnimation { get; set; }

Property Value

bool

UseAutoAddLinkOnEnd

public bool UseAutoAddLinkOnEnd { get; set; }

Property Value

bool

Methods

public void AddLink(Link link)

Parameters

link Link

AddNode(params Node[])

public void AddNode(params Node[] nodes)

Parameters

nodes Node[]

Clear()

protected void Clear()

GetAllParts(Func<Part, bool>)

public IEnumerable<Part> GetAllParts(Func<Part, bool> predicate = null)

Parameters

predicate Func<Part, bool>

Returns

IEnumerable<Part>

InvokeMessage(string)

public virtual void InvokeMessage(string message)

Parameters

message string

OnAddNoded(IEnumerable<Node>)

protected void OnAddNoded(IEnumerable<Node> nodes)

Parameters

nodes IEnumerable<Node>

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnMouseLeftButtonDown(MouseButtonEventArgs)

Invoked when an unhandled MouseLeftButtonDown routed event is raised on this element. Implement this method to add class handling for this event.

protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)

Parameters

e MouseButtonEventArgs

The MouseButtonEventArgs that contains the event data. The event data reports that the left mouse button was pressed.

OnSelectedPartChanged()

protected void OnSelectedPartChanged()

RefreshData()

public void RefreshData()

RefreshLayout()

public void RefreshLayout()

RefreshLinkDrawer()

public void RefreshLinkDrawer()

RemoveNode(params Node[])

public void RemoveNode(params Node[] nodes)

Parameters

nodes Node[]

UpdateNodesToDataSource()

protected void UpdateNodesToDataSource()

ZoomTo(Part, double)

public void ZoomTo(Part part, double scale = 1.8)

Parameters

part Part
scale double

ZoomTo(Point)

public void ZoomTo(Point point)

Parameters

point Point

ZoomTo(Rect, double)

public void ZoomTo(Rect rect, double scale = 1.8)

Parameters

rect Rect
scale double

ZoomToFit(double)

public void ZoomToFit(double scale = 1.2)

Parameters

scale double

ZoomToFit(double, params Part[])

public void ZoomToFit(double scale = 1.2, params Part[] parts)

Parameters

scale double
parts Part[]

ZoomToSelectPart()

public void ZoomToSelectPart()

Events

AddLinked

public event EventHandler<RoutedEventArgs<Link>> AddLinked

Event Type

EventHandler<RoutedEventArgs<Link>>

AddNoded

public event RoutedEventHandler AddNoded

Event Type

RoutedEventHandler

ItemsChanged

public event RoutedEventHandler ItemsChanged

Event Type

RoutedEventHandler

SelectedPartChanged

public event RoutedEventHandler SelectedPartChanged

Event Type

RoutedEventHandler