DiagramDataBindingControllerBase.GenerateConnector Event

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

Namespace: DevExpress.XtraDiagram

Assembly: DevExpress.XtraDiagram.v20.1.dll

Declaration

public event EventHandler<DiagramGenerateConnectorEventArgs> GenerateConnector
Public Event GenerateConnector As EventHandler(Of DiagramGenerateConnectorEventArgs)

Event Data

The GenerateConnector event's data class is DevExpress.XtraDiagram.DiagramGenerateConnectorEventArgs.

Remarks

By default, the uppermost connector defined in XAML within the DiagramDataBindingControllerBase.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 DiagramDataBindingControllerBase.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 DiagramDataBindingController_GenerateConnector(object sender, DiagramGenerateConnectorEventArgs e) {
    if (e.DataObject is Link)
        e.Connector = e.CreateConnectorFromTemplate("CurvedConnector");
    else e.Connector = e.CreateConnectorFromTemplate("DefaultConnector");
}
See Also