Hi Marco Negroni,
Thanks for contacting Syncfusion support.
We have checked the reported issue and unable to reproduce the issue in our end. We have prepared a simple sample when adding shapes by using AddShape() method as you mentioned. Please get the sample from the below link.
We have checked with the below configuration.
Syncfusion Version: 18.4.0.42
Xamarin Forms Version: 5.0.0.1931
UWP Target version: Windows 10.0, Build 17763
So, could you please check the issue with the attached sample and let us know whether it is reproduced?
If the issue is not reproduced in the above sample, please revert us by modifying the sample based on your application along with the replication procedure. It will helpful for us to provide faster solution.
Regards,
Eswaran
Good afternoon,
i found the problem, i made a custom toolbar so i removed the imageeditor toolbar items related to shapes and text:
try the following code and you will get the exception:
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using Syncfusion.SfImageEditor.XForms;
using System.Reflection;
namespace IESample
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class GettingStarted : ContentPage
{
private float currentStrokeWidth = 10;
public GettingStarted()
{
InitializeComponent();
this.imageEditor.SetToolbarItemVisibility("Undo,Redo,Save,Reset,Opacity", false);
this.imageEditor.ToolbarSettings.ToolbarItems.Remove(this.imageEditor.ToolbarSettings.ToolbarItems.Where(x => x.Name == "Text").First());
this.imageEditor.ToolbarSettings.ToolbarItems.Remove(this.imageEditor.ToolbarSettings.ToolbarItems.Where(x => x.Name == "Shape").First());
this.imageEditor.ToolbarSettings.ToolbarItems.Remove(this.imageEditor.ToolbarSettings.ToolbarItems.Where(x => x.Name == "Transform").First());
this.imageEditor.ToolbarSettings.ToolbarItems.Remove(this.imageEditor.ToolbarSettings.ToolbarItems.Where(x => x.Name == "Effects").First());
this.imageEditor.ToolbarSettings.ToolbarItems.Remove(this.imageEditor.ToolbarSettings.ToolbarItems.Where(x => x.Name == "Path").First());
this.imageEditor.ColorPalette.Clear();
this.imageEditor.ColorPalette.Add(Color.Black);
this.imageEditor.ColorPalette.Add(Color.White);
imageEditor.ImageLoaded += ImageEditor_ImageLoaded;
}
private void ImageEditor_ImageLoaded(object sender, ImageLoadedEventArgs args)
{
//this.imageEditor.AddShape(ShapeType.Circle,settings: new PenSettings() { Color = Color.Black, Mode = Mode.Stroke, Opacity = 1f, StrokeWidth = this.currentStrokeWidth });
}
private void Button_Clicked(object sender, EventArgs e)
{
this.imageEditor.AddShape(ShapeType.Path, settings: new PenSettings() { Color = Color.Green, Mode = Mode.Stroke, Opacity = 1f, StrokeWidth = this.currentStrokeWidth });
}
}
class ImageModel
{
public ImageSource Image { get; set; }
public ImageModel()
{
Assembly assembly = typeof(ImageModel).GetTypeInfo().Assembly;
Image = ImageSource.FromResource("IESample.Image.jpeg", assembly);
}
}
}