How to move objects from one layer to another ?Using diagram.MoveObjects - is not working

How to move objects(Nodes) between Layers.Objects are not visible until I add it to new Layer,when I add it to existing Layer -Objects (Nodes) are not visible. 
If I create a new Layer whenever I add new Objects-I was not able to access the Objects from other layers or it is Lying behind the new layer or invisible?So,I decided to have all nodes in one Layer ,whenever i add new Objects/Nodes ,I should be able to Move them to existing Layer and access them.
Nodes are not visible in the below sample. 
Bogenlayer-Is already existing Layer with Nodes/Objects
 void CreateEmptyNodes()
    {
        var li = new ObservableCollection<DiagramNode>();
         List<String> EmptyObjlist = new List<String>();
        string[] EmptyObj = new string[20];
        for(int i=0;i<20;i++)
        {
            li.Add(new DiagramNode()
            {
                Id = "Emptynode"+li.Count,
                //Size of the node
                Width = 100,
                Height = 100,
                //Position of the node
                OffsetX = 300,
                OffsetY = 500,
                Pivot = new NodePivotPoint() { X = 0, Y = 0 },
                Shape = new DiagramShape() { Type = Shapes.Basic, BasicShape = Syncfusion.EJ2.Blazor.Diagrams.BasicShapes.Rectangle },
                Style = new NodeShapeStyle() { Fill = "#ff0000", StrokeColor = "black" },
                Constraints = NodeConstraints.Default & ~(NodeConstraints.Rotate) & ~(NodeConstraints.Resize)
            });
        }
        for (int i = 0; i < li.Count; i++)
        {
            EmptyObjlist.Add(li[i].Id);
            EmptyNodeCollection.Add(li[i]);
            NodeCollection.Add(li[i]);
        }
         EmptyObj = EmptyObjlist.ToArray();
         //Layers.Add(new DiagramLayer() { Id = "Emptylayer", Visible = true, Objects = EmptyObj, Lock = false });
         diagram.MoveObjects(EmptyObj,"Bogenlayer");

         diagram.BringLayerForward("Bogenlayer");
         diagram.SetActiveLayer("Bogenlayer");
         Layers.Where((layer) => layer.Id == "Bogenlayer").FirstOrDefault().Visible = true;
      
      
         StateHasChanged();
    }
Nodes are  visible in below 
 void CreateEmptyNodes()
    {
        var li = new ObservableCollection<DiagramNode>();
         List<String> EmptyObjlist = new List<String>();
        string[] EmptyObj = new string[20];
        for(int i=0;i<20;i++)
        {
            li.Add(new DiagramNode()
            {
                Id = "Emptynode"+li.Count,
                //Size of the node
                Width = 100,
                Height = 100,
                //Position of the node
                OffsetX = 300,
                OffsetY = 500,
                Pivot = new NodePivotPoint() { X = 0, Y = 0 },
                Shape = new DiagramShape() { Type = Shapes.Basic, BasicShape = Syncfusion.EJ2.Blazor.Diagrams.BasicShapes.Rectangle },
                Style = new NodeShapeStyle() { Fill = "#ff0000", StrokeColor = "black" },
                Constraints = NodeConstraints.Default & ~(NodeConstraints.Rotate) & ~(NodeConstraints.Resize)
            });
        }
        for (int i = 0; i < li.Count; i++)
        {
            EmptyObjlist.Add(li[i].Id);
            EmptyNodeCollection.Add(li[i]);
            NodeCollection.Add(li[i]);
        }
         EmptyObj = EmptyObjlist.ToArray();
         Layers.Add(new DiagramLayer() { Id = "Emptylayer", Visible = true, Objects = EmptyObj, Lock = false });
         diagram.MoveObjects(EmptyObj,"Bogenlayer");

         diagram.BringLayerForward("Bogenlayer");
         diagram.SetActiveLayer("Bogenlayer");
         Layers.Where((layer) => layer.Id == "Bogenlayer").FirstOrDefault().Visible = true;
      
      
         StateHasChanged();
    }

3 Replies

GG Gowtham Gunashekar Syncfusion Team February 24, 2020 12:12 PM UTC

Hi Mounika, 
 
We can able to reproduce the reported issue at our end. We are validating the issue and update you with more details on 26th February 2020. 
 
Regards, 
Gowtham G 



AR Aravind Ravi Syncfusion Team February 26, 2020 11:20 AM UTC

Hi Mounika,   
   
Reported Issue : Layer cannot be added at run time using layer collection 
     
We can reproduce the issue. We have confirmed this as a defect. We have logged a defect report for this issue. We will fix this issue and provide the patch on 18th March,2020 weekly patch release.   
    
Now, you can track the status of your issue through below feedback link.   
  
   
Regards,   
Aravind Ravi 




SG Shyam G Syncfusion Team March 19, 2020 12:20 PM UTC

Hi Mounika, 
 
Reported Issue : Layer cannot be added at run time using layer collection  
 
The reported issue has been fixed and included in our Essential Studio 2020 Volume 1 Beta Release v18.1.0.36 and it is available for download from the below link. 
 
 
 
Regards, 
Shyam G 


Loader.
Up arrow icon