Add other shapes

I would like to add other shapes like heart, star, triangle, so I add a Custowview with Xamarin.Path like the example below. However, I can rotate, move but not resize. The path has a fixed length.

Any suggestions on how to add other shapes?


Xamarin.Forms.Shapes.Path path = new Xamarin.Forms.Shapes.Path();

Geometry pathData = (Geometry)new PathGeometryConverter().ConvertFromInvariantString("M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"); 

path.Data = pathData; 

path.Fill = Brush.Red;  

path.Stroke = Brush.Black;

path.Aspect = Stretch.Fill;

 path.HeightRequest = 100; 

path.WidthRequest = 100;  

CustomViewSettings vs = new CustomViewSettings() { Bounds = new Xamarin.Forms.Rectangle(0, 0, 25, 25), CanMaintainAspectRatio = false };                

editor.AddCustomView(path, vs);


01.jpeg02.jpeg


3 Replies 1 reply marked as answer

VR Vignesh Ramesh Syncfusion Team August 28, 2021 06:10 AM UTC

Hi Mário Cleber Bidóia, 

Greetings from Syncfusion. 

We have analyzed the provided code snippet and we would like to inform you that the Xamarin forms path is a drawing element, and it cannot be layout on a new size while resizing. This is framework level limitation. You can use view elements such BoxView, Image, Button, etc and it can be layout and resized properly while using these elements as a custom view of the image editor. 

Let us know if you need any further assistance. 

Regards, 
Vignesh Ramesh. 



MC Mário Cleber Bidóia replied to Vignesh Ramesh August 31, 2021 07:48 PM UTC

Hi,

So is not possible add another shapes? Only rectangle and circle?

Thanks.



VR Vignesh Ramesh Syncfusion Team September 1, 2021 04:16 PM UTC

Hi Mário Cleber Bidóia,  

As per the framework limitations of layouting the shape view, we are unable to resize the shape view and cannot add more shapes using custom view support. 

Regards, 
Vignesh Ramesh. 


Marked as answer
Loader.
Up arrow icon