Hi Nilmer,
We would like to let you know that we have achieved your requirement “Swap image by program” using button click event as like below code snippet.
Behavior.cs
public class Behavior : Behavior<ContentPage>
{
Button Swap;
SfListView ListView;
Random random = new Random();
protected override void OnAttachedTo(ContentPage bindable)
{
Swap = bindable.FindByName<Button>("button");
ListView = bindable.FindByName<SfListView>("listView");
Swap.Clicked += Swap_Clicked;
base.OnAttachedTo(bindable);
}
private void Swap_Clicked(object sender, EventArgs e)
{
var contact = new Model();
contact.Image = ImageSource.FromResource("SfListViewSamples.Images.Image" + random.Next(0, 19) + ".png");
(ListView.BindingContext as ViewModel).ContactsInfo[0] = contact;
}
} |
We have attached the tested sample for your reference, please find the sample in the below link.
Please let us know whether the provided sample meets your requirement.
Regards,
Sangeetha Raju.