Can I do "isVisible=false" on some items in a listview, but not all items, when a button is pressed?

ThankYouThankYou Member ✭✭

Whenever doing "isvisible = false" the whole page will be "IsVisible = false" instead of just the specific item im trying to hide, so is there any way to hide just a few "items/objects" instead of the whole page after a button is pressed?
Can I do something like giving the textcell i want to hide after a button is pressed an x:name="abc" and then refer to it in my .cs code with something like this abc.IsVisible = false;?

Best Answer

Answers

  • ThankYouThankYou Member ✭✭

    @seanyda Where do I put this code? And will the list with isManager == true be displayed? Thanks!

  • seanydaseanyda GBMember ✭✭✭✭✭

    @ThankYou said:
    @seanyda Where do I put this code? And will the list with isManager == true be displayed? Thanks!

    The above is a real world example, You need to adjust your code to workaround my solution. You will have a class, which will have a bool (which should be the bool you are toggling to decide whether to show a cell) and you will filter the list based on that bool.

  • ThankYouThankYou Member ✭✭

    @seanyda , I did adapt the code, but the listview isn't being changed to the new list after the button is pressed, would you know how to do that? Thanks for the help. :)

  • seanydaseanyda GBMember ✭✭✭✭✭

    @ThankYou said:
    @seanyda , I did adapt the code, but the listview isn't being changed to the new list after the button is pressed, would you know how to do that? Thanks for the help. :)

    It all depends on your set up. If you're using a design pattern like MVVM you will need to fire the OnPropertyChanged event for the ListView to update. If you're not using MVVM if you can just get an instance of the ListView whether thats using x:Name in XAML or reference in C# just set it like the below:

    listViewReference.Where(w => w.isVisibleBoolean == true)
    
  • ThankYouThankYou Member ✭✭

    @seanyda , I really just want to hide some items when a switch cell or a button is pressed, can I not use the isvisibleproperty? The method you are suggesting is what I had in mind as well, but I have figured out that I need to learn a lot of stuff to make it work. Would you know how to use the isvisible = false; command to just some objects and not the whole page? (Original question basically :) ). Thanks.

Sign In or Register to comment.