Hi developers,
I am using the CircleImage control from this page: https://blog.xamarin.com/elegant-circle-images-in-xamarin.forms/
When I set the Source of the image directly while the page loads it works very well, but if I set the Source sometime later it seems the image will not be shown.
The strange thing about it is, that it runs on Android 5.0 and higher without any problems. The images are displayed
Somebody has an idea what's wrong ?
Example: I call a webservice at startup and when the call executed and a response received I set the Source property.
View
var avatar = new CircleImage
{
AnchorX = 0,
AnchorY = 0,
HorizontalOptions = LayoutOptions.CenterAndExpand,
VerticalOptions = LayoutOptions.StartAndExpand,
HeightRequest = 150,
WidthRequest = 150,
Aspect = Aspect.AspectFill,
BorderColor = Color.Green,
BorderThickness = 10,
};
avatar.SetBinding(CircleImage.SourceProperty, new Binding("AvatarUri"));
ViewModel
public string AvatarUri
{
get { return model.AvatarURI; }
set
{
model.AvatarURI = value;
OnPropertyChanged();
}
}
private void OnGetPublicUserProfileByUserID(MobileApiHandlerEventArgs eventArgs)
{
IsBusy = false;
var e = eventArgs.ResponseParameter as GetPublicUserProfileByUserIDCompletedEventArgs;
if (e.Result.ErrorArgs.ErrorRaised)
return;
if (e.Result.UserProfilePublic != null)
{
var publicProfile = e.Result.UserProfilePublic;
AvatarUri = publicProfile.AvatarURI;
}
}