Articles in this section
Category / Section

How to restrict the Connector's source and target decorator from being positioned in different places in WPF Diagram (SfDiagram)?

3 mins read

In the WPF Diagram, you can restrict the connector’s TargetDecorator and SourceDecorator from being positioned in different places by setting the Stretch property to Fill in the TargetDecoratorStyle and SourceDecoratorStyle property of the Connector. Here’s a code example to demonstrate how to achieve this.

XAML Code Snippet:

<!--Style for the Connector-->
<Style TargetType="syncfusion:Connector">
   <Setter Property="ConnectorGeometryStyle">
       <Setter.Value>
           <Style TargetType="Path">
               <Setter Property="Stroke" Value="#6BA5D7"/>
               <Setter Property="StrokeThickness" Value="1"/>
           </Style>
       </Setter.Value>
   </Setter>
   <Setter Property="TargetDecoratorStyle">
       <Setter.Value>
           <Style TargetType="Path">
               <Setter Property="Fill" Value="#6BA5D7"/>
               <Setter Property="StrokeThickness" Value="1"/>
               <!-- Set the Stretch property to fill-->
               <Setter Property="Stretch" Value="Fill"/>
           </Style>
       </Setter.Value>
   </Setter>
   <Setter Property="SourceDecoratorStyle">
       <Setter.Value>
           <Style TargetType="Path">
               <Setter Property="Fill" Value="#6BA5D7"/>
               <Setter Property="StrokeThickness" Value="1"/>
               <!-- Set the Stretch property to fill-->
               <Setter Property="Stretch" Value="Fill"/>
           </Style>
       </Setter.Value>
   </Setter>
</Style> 
BEFORE AFTER
connector
connector

Conclusion
I hope you enjoyed learning about how to restrict the Connector’s target decorator from being positioned in different places in the WPF Diagram.
You can refer to our WPF Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

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