Issue
My object has a property set elsewhere called:
ImageSrc = "icon.png"
In xaml file I am trying to bind to this:
<Image Source="{Binding ImageSrc}" />
In the ViewModel I am setting the property as such:
private string _imageSrc;
public string ImageSrc
{
get => this._imageSrc;
set
{
this._imageSrc = value;
this.RaisePropertyChanged(() => this.ImageSrc);
}
}
public override Task InitializeAsync(object _params)
{
ObjectParameters _objectParameters = (ObjectParameters)_params;
this.ImageSrc = _objectParameters.ImageSrc;
return Task.CompletedTask;
}
If I set this in class constructor:
this.ImageSrc = "icon.png";
it binds fine but not after calling:
public override Task InitializeAsync(object _params)
the property is set properly with the correct value of "icon.png" but the image does not show like when set in the class constructor. Any ideas appreciated.
Solution
I had to right click on Resources/drawable/icon.png then Add To Project and make sure Build Action: AndroidResource
Answered By - user11317802
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.