Sagar Patil
Sagar Patil

Reputation: 469

Images are not binding in xamarin.forms?

I am working in xamarin.forms. Local images are not binding. The image folderenter image description here

code to retrieving image is

    public const string RESOURCE_CIRCLE = "RadioCheckNoPlugin.Controls.Resources.circle.png";
public const string RESOURCE_DOT = "RadioCheckNoPlugin.Controls.Resources.dot.png";

public IconView iconCircle = new IconView { Source = ImageSource.FromResource(RESOURCE_CIRCLE), FillColor = GlobalSetting.BorderColor, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center, HeightRequest = GlobalSetting.Size, WidthRequest = GlobalSetting.Size };
public IconView iconChecked = new IconView { Source = ImageSource.FromResource(RESOURCE_DOT), FillColor = GlobalSetting.Color, IsVisible = false, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center, HeightRequest = GlobalSetting.Size, WidthRequest = GlobalSetting.Size };

Image property Build Action:Embedded resource and I am not getting any errors. I tried by removing .png extension also but it's not binding. Please help me with how to bind images.

Upvotes: 3

Views: 184

Answers (1)

Mukesh Modhvadiya
Mukesh Modhvadiya

Reputation: 2178

Change your image path constants as below :

public const string RESOURCE_CIRCLE = "resource://RadioCheckNoPlugin.Controls.Resources.circle.png";
public const string RESOURCE_DOT = "resource://RadioCheckNoPlugin.Controls.Resources.dot.png";

Upvotes: 0

Related Questions