Articles in this section
Category / Section

How to toggle the visibility of connector at runtime in WPF Diagram (SfDiagram)?

2 mins read

Toggle the Visibility of Connector

Connectors are objects used to create link between two points, nodes, or ports to represent the relationship between them. In some cases, you need to toggle the connector visibility. You can hide the connector by adding the custom property in ConnectorViewModel.

Create the custom class from ConnectorViewModel with the custom property to toggle the visibility.

public class Connectorvm : ConnectorViewModel
  private bool _visible=true;
  public bool CanVisible
    get { return _visible; }
      if (_visible != value) 
        _visible = value;

Bind the custom property with “Visibility” (framework property) of the Connector(View) with converter.

<Style TargetType="syncfusion:Connector">
    <!—Boolean to Visibility-->
    <Setter Property="Visibility" Value="{Binding CanVisible,Converter={StaticResource BooleanToVisibilityConverter}}"></Setter>

The connector supports appearance customization, bridging effect when two connectors cross over and SegmentDecorator to represent the flow.

Did you find this information helpful?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied