We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Swap image by program

I would like some example of how to at any given time swap the image in a ListView in SfListView-Image.

Thank you for now

2 Replies

SR Sangeetha Raju Syncfusion Team August 4, 2019 05:08 PM UTC

Hi Nilmer, 
We are validating your query. We will update the details further on or before August 6, 2019.  
We appreciate your patience until then. 
Sangeetha Raju. 

SR Sangeetha Raju Syncfusion Team August 6, 2019 11:21 AM UTC

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. 
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; 
   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. 
Sangeetha Raju.

Live Chat Icon For mobile
Up arrow icon