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.
|
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;
}
} |
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.
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/
I was update my sfdiagram,but the HitPadding and PortVisibility constraints of node is still not working when drag and drop from stencil
here is my project base stencil sample
https://drive.google.com/file/d/1Xd1ehII1ZtN1uJ7hzHBr5vF1OtUId4Fr/view?usp=sharing
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
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:
|
|
|
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:
|
Modified sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/StencilDiagramElementsModified756048760
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
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
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
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
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(), // Key作为node的标识符而不是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
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
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
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
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
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
Thank you for solving my problem!
Now there is a new problem, I downloaded the project you provided, when I load the serialized saved .xaml file, I get an error.
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
Sorry for not giving specific project files before, this is my project:
https://drive.google.com/file/d/1Z6tofq6PATYMBqyJxRaX6GpKdnrWvv2F/view?usp=sharing
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
Thanks for solving my problem, it works great now
You are welcome. Please let us know if you require any further assistance.