Diagram adding nodes from stencil is missing node's HIttpadding, portvisible and other constraints.

I create a stencil and added a instance of NodeViewMode in the stencil, but when I drag a node into a diagram from the stencil, constraints such as node's Hitpadding and Portvisiable are invalidated. After testing, manually add nodes use code will not have this problem.


25 Replies 1 reply marked as answer

DT Deepa Thiruppathy Syncfusion Team March 14, 2022 02:38 PM UTC

Hi Tealer, 
 
Reported issue: HitPadding and PortVisibility constraints of node is not working when drag and drop from stencil. 
 
We are able to reproduce the issue. We will validate and update the details on March 16, 2022. 
 
Regards, 
Deepa Thiruppathy 
  
  



DT Deepa Thiruppathy Syncfusion Team March 17, 2022 09:32 AM UTC

We have validated the issue and logged the bug report for the same. We will fix the issue and the fix will be included in our upcoming weekly NuGet release which is expected to be released on April 5, 2022.  
 
Please find feedback link below, 
 
 
To avoid this issue temporarily, we have manually serialized the HitPadding and PortVisibility properties for the node which is being added from stencil to diagram. 
 
Code snippet: 
private void MainWindow_ItemAdded(object sender, ItemAddedEventArgs args) 
{ 
    //Serializing HitPadding and PortVisibility properties manually to cloned node from original node. 
    if (args.Item is INode && args.OriginalSource is INode && args.ItemSource == ItemSource.Stencil) 
    { 
        INode clonedNode = args.Item as INode; 
        INode originalNode = args.OriginalSource as INode; 
        clonedNode.HitPadding = originalNode.HitPadding; 
        clonedNode.PortVisibility = originalNode.PortVisibility; 
    } 
} 
 



DT Deepa Thiruppathy Syncfusion Team April 6, 2022 12:08 PM UTC

Sorry, Due to the main release of Volume 1, 2022 weekly NuGet packages was not released as promised on April 5, 2022. So the fix will be included in our upcoming weekly NuGet release which is expected to be released on April 12, 2022.



DT Deepa Thiruppathy Syncfusion Team April 12, 2022 01:47 PM UTC

Reported issue: HitPadding and PortVisibility constraints of node is not working when drag and drop from stencil.


We are glad to announce that our weekly NuGet was rolled out and fix for the reported issue was included in the weekly NuGet.


NuGet Version: 20.1.0.48


NuGet Link: https://www.nuget.org/packages/Syncfusion.SfDiagram.WPF/



TE tealer replied to Deepa Thiruppathy April 16, 2022 07:44 AM UTC

I was update my sfdiagram,but the  HitPadding and PortVisibility constraints of node is still not working when drag and drop from stencil



TE tealer replied to Deepa Thiruppathy April 16, 2022 08:27 AM UTC



TE tealer replied to Deepa Thiruppathy April 16, 2022 08:49 AM UTC

It seems that when dragging from the node in the stencil to the diagram, the set node contentTemplate does not take effect, and the other constraints are the same



DT Deepa Thiruppathy Syncfusion Team April 18, 2022 08:05 AM UTC

Please find below response table for your queries,


Query

Response

I was update my sfdiagram,but the  HitPadding and PortVisibility constraints of node is still not working when drag and drop from stencil

We have validated the given sample. Connectable constraint is removed from node where node could not connect any other nodes and ports. We have modified the sample with proper constraints.

 

Code snippet:

 

//Removed constraint for ports

Constraints = & ~(PortConstraints.InheritConnectable) & PortConstraints.Connectable,

//Updated constraints. Use this

Constraints = PortConstraints.Default & ~(PortConstraints.InheritConnectable | PortConstraints.Connectable),

 

//Removed constraint for node.

Constraints = NodeConstraints.Default & ~NodeConstraints.Connectable & ~NodeConstraints.Resizable & ~NodeConstraints.InheritResizable &~NodeConstraints.InheritHitPadding & ~NodeConstraints.InheritPortVisibility,

//Updated constraints. use this.

Constraints = NodeConstraints.Default & ~(NodeConstraints.InheritHitPadding| NodeConstraints.Resizable| NodeConstraints.InheritResizable | NodeConstraints.InheritPortVisibility),

PortVisibility = PortVisibility.Visible,

HitPadding = 40,

 

 

It seems that when dragging from the node in the stencil to the diagram, the set node contentTemplate does not take effect, and the other constraints are the same

We do not have direct support to serialize the Content and ContentTemplate properties. We have modified the shared sample to meet your requirements. In that sample we have serialized the ContentTemplate property value of node manually at PropertyChanged method by using custom property.

 

Code snippet:

 

protected override void OnPropertyChanged(string name)

{

    base.OnPropertyChanged(name);

    switch (name)

    {

        case "ContentTemplateId":

            this.ContentTemplate = App.Current.Resources[this.ContentTemplateId] as DataTemplate;

            break;

    }

}

 

 


Modified sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/StencilDiagramElementsModified756048760



TE tealer replied to Deepa Thiruppathy April 23, 2022 02:10 PM UTC

Tank you for your patience.

I modified my project as you suggested and now it works. But I added a bit of content later, including rewriting and inheriting the diagram. After my modification, the content template is not displayed again. This is my project.


https://drive.google.com/file/d/1NCNERPnqSOBARvW1ZGX39Pea3umdGmk6/view?usp=sharing



KR Karkuvel Rajan Shanmugavel Syncfusion Team April 25, 2022 11:19 AM UTC

Hi Tealer,


Currently, we are validating the provided sample. We will update you with more details on 27th April,2022.


We will appreciate your patience until then.


Regards,

Karkuvel Rajan S



DT Deepa Thiruppathy Syncfusion Team April 28, 2022 11:41 AM UTC

Hi Tealer,


Reported issue: Content and content template is not serialised properly.


We are able to serialise the content and content template of the nodes properly which are drag and dropped from stencil. We have tried it for Save and load, duplicating the node. Can you please share exact case and replication steps for given project file to reproduce the issue, Or share any video representation to replicate the issue?


Regards,

Deepa Thiruppathy



TE tealer replied to Deepa Thiruppathy April 29, 2022 01:37 AM UTC

This is my project, I use syncfusion.wpf 20.1.0.51, it still don't show ContentTemplate on node when dragged out of the stencil.

this is my project :

https://drive.google.com/file/d/1NCNERPnqSOBARvW1ZGX39Pea3umdGmk6/view?usp=sharing



DT Deepa Thiruppathy Syncfusion Team April 29, 2022 05:39 AM UTC

Reported issue: Content template values of the stencil nodes are not properly serialized.


We have validated the given project. You have missed to update ContentTemplateId property to stencil Nodes. We have modified the sample to serialize the content template of the stencil nodes properly.


Code snippet:


public CustomNode CreateNewFunctionBlockNormalTimer()

{

    // 创建一个普通计时器功能块

    CustomNode NewNode = new CustomNode()

    {

        Constraints = NodeConstraints.Default & ~NodeConstraints.Resizable &

        ~NodeConstraints.InheritResizable & ~NodeConstraints.Connectable,

        ID = "FB_NormalTimer" + FBNormalTimerNum.ToString(),

        Name = "FunctionBlockNormalTimer", // Node的名字

        Key = "FB_NormalTimer" + FBNormalTimerNum.ToString(), // Keynode标识符而不是id

        UnitWidth = 120,

        UnitHeight = 80,

        OffsetX = 300,

        OffsetY = 80,

        HitPadding = 40, // 命中填充

        ContentTemplate = App.Current.Resources["FB_NormalTimner"] as DataTemplate,

        //Initialize the content template Id property value.

        ContentTemplateId = "FB_NormalTimner",

    }

}


Modified sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SuncfusionMinorHillTest249247368



TE tealer replied to Deepa Thiruppathy May 24, 2022 06:56 AM UTC

Thank you for prompt answer, I tried the code you gave, the contentTemplate now working, but the hitpadding and constraints is still not working.


here is my project



DT Deepa Thiruppathy Syncfusion Team May 25, 2022 02:06 PM UTC

Hi Tealer,


We are able to reproduce the issue in your previously shared application. We will validate this issue and update you the more details on May 26, 2022.


Regards,

Deepa Thiruppathy



KR Karkuvel Rajan Shanmugavel Syncfusion Team May 26, 2022 06:00 AM UTC

Hi Tealer,


Reported issue: HitPadding and PortVisibility constraints of the nodes are not working when dragging and dropping from stencil. 


We have fixed the reported issue on the sample side. In the sample, you have used the Rectangle and Ellipse Geometry for the Port’s Shape Property. We have changed them to get the shape of our resources. For HitPadding we have noted that you have misplaced the order of the constraints. We have modified them too. Please find the modified sample in the below link.


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SyncfusionWpfTest1-1017673977


Regards,

Karkuvel Rajan S



TE tealer replied to Karkuvel Rajan Shanmugavel May 30, 2022 03:27 AM UTC

Thank your for your reply.

this is my project

https://drive.google.com/file/d/1yzOuHpmZ1vmIFv3Z8We9IDJpJINiILAh/view?usp=sharing

the method you reply is useless to my project, the PortVisibility and hit padding is still not work while use stencil



KR Karkuvel Rajan Shanmugavel Syncfusion Team May 30, 2022 12:04 PM UTC

Hi Tealer,


Reported Issue: HitPadding and PortVisibility properties of the NodePort are not working.


We have fixed the reported issue on the sample side. Please find the modified sample in the below link. In the sample, we have found that you have tried to set HitPadding for Port. But in our previous fix, we have fixed the HitPadding issue in Node. So, please use the below-modified sample now. We will fix the HitPadding issue for Port in our upcoming weekly NuGet release.


Modified sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SyncfusionWpfTest1_modified-1973734063


Regards,

Karkuvel Rajan S


Marked as answer

TE tealer replied to Karkuvel Rajan Shanmugavel May 31, 2022 03:18 AM UTC

Thank you for solving my problem!



TE tealer replied to Karkuvel Rajan Shanmugavel May 31, 2022 08:16 AM UTC

Now there is a new problem, I downloaded the project you provided, when I load the serialized saved .xaml file, I get an error.



KR Karkuvel Rajan Shanmugavel Syncfusion Team June 1, 2022 07:46 AM UTC

We are not facing any issues in saving and loading the diagram. We have prepared a simple demo video to demonstrate that. Please find the video in the below link. Could you please update the steps before saving and loading the diagram? That will help us to validate further.


Demo video link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Demo_Video1819639502



TE tealer replied to Karkuvel Rajan Shanmugavel June 1, 2022 09:01 AM UTC

Sorry for not giving specific project files before, this is my project:

https://drive.google.com/file/d/1Z6tofq6PATYMBqyJxRaX6GpKdnrWvv2F/view?usp=sharing



KR Karkuvel Rajan Shanmugavel Syncfusion Team June 2, 2022 05:33 AM UTC

We have fixed the issue on the sample side. Please find the modified sample in the below link.


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SyncfusionWpfTest1_sample_Modified455057189



TE tealer replied to Karkuvel Rajan Shanmugavel June 7, 2022 09:05 AM UTC

Thanks for solving my problem, it works great now



DT Deepa Thiruppathy Syncfusion Team June 8, 2022 06:15 AM UTC

You are welcome. Please let us know if you require any further assistance.


Loader.
Up arrow icon