Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Show and Hide controls present in listview's view cell based on server response

RaviDixitRaviDixit USMember ✭✭

I have a listview in which I have created a custom view cell,

in that custom view cell I have a label, based on the server response i want to show and hide the label in different ViewCell.

My question is how can i achieve this?

Do i create a private method in my view model class which would do the dirty work of iterating the list and based on my server response, I manually inject a Boolean flag inside the list object and Bind a bool value to the label IsVisible property OR Is there some other way to achieve this

Best Answers

Answers

  • RaviDixitRaviDixit USMember ✭✭

    @AdamP I got your point, so can i further do something like this

    1. Fetch data from server and do the filtering for values which I want Boolean
    2. Once my data is populated in the List Object I can later apply the same as ItemSource to my ListView

    I actually wana hide a StackLayout in my ListView so is it advisable to use ObservableCollections or using the List object should work fine?

  • AdamPAdamP AUUniversity ✭✭✭✭✭

    @RaviDixit - If you are reapplying the whole list each time then use a List, otherwise if you are adding and removing in realtime then use an Observable.

Sign In or Register to comment.