Reputation: 469
I am working in xamarin.forms. Local images are not binding. The image folder
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
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