We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Snapping is not working.

Hello,

It works when I first drag and drop from snapping stecil. But I can't Snapping between the items I uploaded to the diagram. What could be the reason? can you help?


        <Syncfusion:SfDiagram x:Name="diagram"

                              Grid.Column="1"

                              Nodes="{Binding Nodes}"

                              HorizontalAlignment="Left"

                              VerticalAlignment="Top"

                              Background="Transparent"

>

            <Syncfusion:SfDiagram.HorizontalRuler>

                <Syncfusion:Ruler />

            </Syncfusion:SfDiagram.HorizontalRuler>

            <Syncfusion:SfDiagram.VerticalRuler>

                <Syncfusion:Ruler Orientation="Vertical" />

            </Syncfusion:SfDiagram.VerticalRuler>

            <Syncfusion:SfDiagram.PageSettings>

                <Syncfusion:PageSettings PageWidth="800"

                                         PageHeight="600"

                                         PrintMargin="0"

                                         ShowPageBreaks="True"

                                         MultiplePage="False"

                                         PageBackground="Transparent">

                    <Syncfusion:PageSettings.Unit>

                        <Syncfusion:LengthUnit Unit="Pixels"/>

                    </Syncfusion:PageSettings.Unit>

                </Syncfusion:PageSettings>

            </Syncfusion:SfDiagram.PageSettings>

            <Syncfusion:SfDiagram.SnapSettings>

                <Syncfusion:SnapSettings SnapToObject="All"/>

            </Syncfusion:SfDiagram.SnapSettings>

            <Syncfusion:SfDiagram.Connectors>

                <Syncfusion:ConnectorCollection>

                </Syncfusion:ConnectorCollection>

            </Syncfusion:SfDiagram.Connectors>

        </Syncfusion:SfDiagram>


5 Replies 1 reply marked as answer

PP Prakash Perumal Syncfusion Team February 21, 2023 06:35 AM UTC

Hi Ozgur,


We are unable to reproduce the reported issue that the snap-lines do not appear correctly when interacting with the nodes in the diagram. We have shared you a sample for your reference. Could you please check the sample and try to modify it to reproduce the issue?


Regards,

Prakash


Attachment: DiagramSampleSymbol_df7e1883.zip


ÖZ Özgür February 21, 2023 05:29 PM UTC

Thank you for the answer. I will apply. As an additional question, when I do Ctrl+C Ctrl+V, the object is copied but the object is empty. Do I have to activate something for this?



PP Prakash Perumal Syncfusion Team February 22, 2023 09:10 AM UTC

Hi Ozgur,


In SfDiagram, we cannot directly serialize the Content and ContentTemplate properties of a Node. However, we can accomplish this using custom properties. Please refer to the attached modified sample, which enables copying and pasting an object with a custom template.


Regards,

Prakash


Attachment: DiagramSample180635_c9c65e2d.zip


ÖZ Özgür February 23, 2023 01:34 PM UTC

Hello, I solved all my problems, thank you. When the node is deleted in the demo you sent, I get a binding error as follows. What is the reason ?


System.Windows.Data Error: 23 : Cannot convert '<null>' from type '<null>' to type 'System.Windows.Media.ImageSource' for 'en-US' culture with default conversions; consider using Converter property of Binding. NotSupportedException:'System.NotSupportedException: ImageSourceConverter, (boş) öğesinden dönüştüremez.

   path: System.ComponentModel.TypeConverter.GetConvertFromException(Object value)

    path : System.Windows.Media.ImageSourceConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)

    path : MS.Internal.Data.DefaultValueConverter.ConvertHelper(Object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, Boolean isForward)'



PP Prakash Perumal Syncfusion Team February 24, 2023 09:50 AM UTC

Hi Ozgur,


We have identified the reported binding error is caused by clearing the Content property prior to the ContentTemplate property while disposing the node. We will resolve this internally in our upcoming release.


To prevent this error in the meantime, please use the code provided below:

(diagram.Info as IGraphInfo).ItemDeleted += (s, e) =>

{

    if (e.Item is INode node) node.ContentTemplate = null;

};


Regards,

Prakash


Marked as answer
Loader.
Up arrow icon