I have created a query that returns a list and I would like to hide or show an icon depending on a string values like this, but i dont know if its possible.
https://i.stack.imgur.com/eiP57.png
I tried to binding the StackLayout but it didn't work.
XAML The elements its on a CollectionView:
https://i.stack.imgur.com/PB7cT.png
VIEWMODEL
https://i.stack.imgur.com/A5qjY.png https://i.stack.imgur.com/kuuiE.png
VIEW
https://i.stack.imgur.com/38ah4.png
the two icons should disappear in one of the elements
Any other solution?
Thank you so much in advance
From the
YouPage.xamlcode you posted, I found that the propertyIsVisibleIconsshould belong to each item of the List you want to show, right?Then, if you want to hide or show an icon based on the value of
IsVisibleIconsof theItem, you need to change the value of the Item in the list (yours isconversations).But from the screenshot you shared , theIsVisibleIconsfield appears to be a global variable, not a property of theItem.Besides, I couldn't see the other code, but you also need to implement interface
INotifyPropertyChangedfor yourItemmodel.Based on your code, I achieved a simple demo , you can refer to the following code:
TestPage.xaml.cs
TestPage.xaml.cs
MyViewModel.cs
Item.cs