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.v24.1.dll
NuGet Package: DevExpress.Wpf.Diagram
Declaration
Event Data
The GenerateConnector event's data class is DevExpress.Xpf.Diagram.DiagramGenerateConnectorEventArgs.
Remarks
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.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GenerateConnector event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.