connector StrokeDashArray property is only applied to first connector

Hi,

I have a connector style defined like so:

  <Style TargetType="Path" x:Key="ConnectorStyleUnconfirmed">

                <Setter Property="Stroke" Value="LightGray"/>

                <Setter Property="StrokeThickness" Value="2"/>

                <Setter Property="StrokeDashArray" Value="1"/>

            </Style>

When I draw connectors in a diagram using the following code, only the first connector drawn will have a dotted line; all following connectors are drawn with  a solid line. In the example below, I see connector 1 dotted but connector2 solid:

diagram = NewDiagram();

ObservableCollection<NodeViewModel> nodes = new ObservableCollection<NodeViewModel>();

ObservableCollection<ConnectorViewModel> connections = new ObservableCollection<ConnectorViewModel>();

RootGrid.Children.Add(diagram);

diagram.Nodes = nodes;

diagram.Connectors = connections;


        //Define the Connector

        ConnectorViewModel connector1 = new ConnectorViewModel()

        {

            SourcePoint = new Point(100, 100),

            TargetPoint = new Point(200, 200),

            ConnectorGeometryStyle = this.Resources["ConnectorStyleUnconfirmed"] as Style,

        };

        //Adding Connector to Collection

        connections.Add(connector1);


        //Define the Connector

        ConnectorViewModel connector2 = new ConnectorViewModel()

        {

            SourcePoint = new Point(200, 300),

            TargetPoint = new Point(400, 400),

            ConnectorGeometryStyle = this.Resources["ConnectorStyleUnconfirmed"] as Style,

        };

        //Adding Connector to Collection

        connections.Add(connector2);

I would like all connectors drawn with this style to be drawn with the dotted line. Please advise.


3 Replies

DT Deepa Thiruppathy Syncfusion Team December 9, 2022 06:51 AM UTC

Hi Marion,


Reported issue: StrokeDashArray property is applying for first connector alone.


We are able to reproduce the issue. We will validate and update you more details on or before December 13,2022.


Regards,

Deepa Thiruppathy



DT Deepa Thiruppathy Syncfusion Team December 13, 2022 02:42 PM UTC

Hi Marion,


Reported issue: StrokeDashArray property is applying for first connector alone.


We have validated the reported issue and it is a framework level issue. StrokeDashArray is not applied to different elements from same resource key.


We have demonstrated this behavior in a simple sample for your reference,


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/StrokeDashArraySample-1934170979


Currently we are trying to fix this issue at sample level for diagram case.



DT Deepa Thiruppathy Syncfusion Team December 14, 2022 01:43 PM UTC

Hi Marion,


Reported issue: StrokeDashArray property is applying for first connector alone.


To fix this issue, we have applied the style to connectors in its custom connector class. We have created a simple sample for your reference,


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/StrokeDashArrayFix-1951483832


Note: If this post is helpful, please consider Accepting it as the solution. so that other members can locate it more quickly.


Loader.
Up arrow icon