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; }
    set
    {
      if (_visible != value) 
      {
        _visible = value;
        OnPropertyChanged("CanVisible");
      }
    }
  }
}

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>
</Style>

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

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