Change background of basic shapes

I have stencils with basic shapes.

I want to add props panel, where i can chnage background for shape and border of predefined nodes.

I saw, that i can change color via style... but can i do it within ColorPicker?


7 Replies 1 reply marked as answer

KR Karkuvel Rajan Shanmugavel Syncfusion Team September 30, 2021 05:06 AM UTC

Hi Anton, 
 
Requirement: Need to change the background color of the basic shapes. 
 
We have analyzed your requirement. We can change the background of the basic shapes with the ShapeStyle property. But we need some details to achieve your requirement. Please update the below required details. 
 
  • We need to know whether you want to change the background color of the basic shape in stencil or you want to change the background color of the basic shape after drag and drop from stencil to diagram.
 
Regards, 
Karkuvel Rajan S 



AN Anton September 30, 2021 05:53 AM UTC

I need change background color via ColorPicker after object is added to diagram.

And this color should save and restored correctly.


Assume that we have propertygrid for selected object in diagram and user can change color via this propertygrid



KR Karkuvel Rajan Shanmugavel Syncfusion Team October 1, 2021 11:43 AM UTC

Hi Anton, 
 
Requirement: Need to change the background color of the basic shapes. 
 
Thanks for the update. We have prepared a simple sample for your requirement. In the sample we have used CustomNode to achive your requirement of change the fill and stroke color of the dragged node. Please find the sample link below. 
 
 
Regards, 
Karkuvel Rajan S 



AN Anton October 1, 2021 01:01 PM UTC

Thank you! As i see we can do this only with custom nodes...



KR Karkuvel Rajan Shanmugavel Syncfusion Team October 2, 2021 06:53 AM UTC

Hi Anton, 
 
Requirement: Need to change the background color of the basic shapes. 
 
Thanks for the update. In our SfDiagram control, we have Shapestyle property for diagram elements to change its style. If you use default Node to change its fill or stroke color then you have to write new style for each and every time when the fill or stroke color gets changed. So only we have used custom node with FillColor and StrokeColor properties. Please confirm us if you need default Node then we will modify the already provided sample based on your requirement. 
 
Regards, 
Karkuvel Rajan S 



AN Anton October 2, 2021 07:37 AM UTC

It will be great!




KR Karkuvel Rajan Shanmugavel Syncfusion Team October 4, 2021 04:38 AM UTC

Hi Anton,                                                                                                                                             
 
Requirement: Need to change the background color of the basic shapes.  
 
Sorry for the inconvenience caused. 
 
We have tried to achieve your requirement with the default nodes. But when tried with default we have faced problem in serializing the Shapestyle and to display the background color in the PropertyGrid.  
 
  • In our SfDiagram control, you cannot serialize Content, ContentTemplate, Shape, and ShapeStyle of each and every diagramming objects. If you want to preserve the ShapeStyle and ContentTemplate of diagramming objects, keep them in resources and apply once the diagramming objects are added to the Diagram page. To get the resource name we have to implement the custom properties in custom class derived from any of our SfDiagram’s interface.
 
  • In PropertyGrid, while selecting node it will show only the properties of the item based on its type. When we use default node then it will not show the background color in colorpicker. It will show only the Shapestyle resource.
 
So, we have insist you to use the custom node to achieve your requirement. 
 
Regards, 
Karkuvel Rajan S 


Marked as answer
Loader.
Up arrow icon