Articles in this section
Category / Section

How to resolve Image is not appearing in Release mode in SfImageEditor XForms.UWP?

1 min read

Xamarin does not load the renderer assemblies by default in Xamarin.Forms.UWP project in Release mode. So, In order to solve this, You have to manually load it by creating instance of Renderer class in App.cs file.

Step 1: Create an instance of SfImageEditorRenderer in App.cs file. Use the below code snippet.

 

protected override void OnLaunched(LaunchActivatedEventArgs e)
{
    List<Assembly> assembliesToInclude = new List<Assembly>();
    assembliesToInclude.Add(typeof(Syncfusion.SfImageEditor.XForms.UWP.SfImageEditorRenderer).GetTypeInfo().Assembly);
    Xamarin.Forms.Forms.Init(e, assembliesToInclude);
}

 

Step 2: To support displaying embedded images in release mode on forms Universal Windows Platform, it’s necessary to use the overload of ImageSource.FromResource that specifies the source assembly in which to search for the image.

Code Snippet:

public MainPage()
{
    InitializeComponent();
    imageeditor.Source = ImageSource.FromResource([Namespace.Imagename.Imagetype],typeof(App).GetTypeInfo().Assembly);
}                                                     

 

Example:

 

imageeditor.Source = ImageSource.FromResource("Filename.png",typeof(MyClass).GetTypeInfo().Assembly);                                                                                                    

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied