Skip to main content

DiagramDataBindingBehaviorBase.GenerateConnector Event

Fires before generating a connector from the data source and allows you to customize it.

Namespace: DevExpress.Xpf.Diagram

Assembly: DevExpress.Xpf.Diagram.v22.1.dll

NuGet Package: DevExpress.Wpf.Diagram


public event EventHandler<DiagramGenerateConnectorEventArgs> GenerateConnector

Event Data

The GenerateConnector event's data class is DevExpress.Xpf.Diagram.DiagramGenerateConnectorEventArgs.


By default, the uppermost connector defined in XAML within the DiagramDataBindingBehaviorBase.TemplateDiagram is used as the template for the connectors.

You can use the GenerateConnector event to implement custom logic for choosing the connector template. To do this, create connectors in the DiagramDataBindingBehaviorBase.TemplateDiagram and specify their names using the DiagramItem.TemplateName property. Specify the name of the desired template as the event’s CreateConnectorFromTemplate method parameter and assign the method return value to the event’s Connector property. See the example below.

private void DiagramDataBindingBehavior_GenerateConnector(object sender, DiagramGenerateConnectorEventArgs e) {
    if (e.DataObject is Link)
        e.Connector = e.CreateConnectorFromTemplate("CurvedConnector");
    else e.Connector = e.CreateConnectorFromTemplate("DefaultConnector");

Alternatively, you can use the DiagramDataBindingBehaviorBase.ConnectorTemplateSelector property.

See Also