Is there a way to replicate this in forms?I want to show a message like "empty list" when listveiw is empty.
It could be that you put a label in the middle (in invisible mode), at the moment of loading the information if nothing was found, shown as visible (label) and the Liistview as invisible
I think yes.
You could have a label with "EMPTY LIST" that has IsVisible binded to ListViewItem.Count (Also listview should have the IsVisible property binded with ListViewItem.Count...), then, if Count > 0, Label is not visible (and list is visible). if Count == 0, Label is visible and ListView is not visible... hope to be clear also without a line of code...
@AlessandroCaliaro I understand the logic but can you give an example?
here you can find a demo (born for other things but added your problem).
You found 3 items in your listview.
If you press "Description", you will popup a dialog. Select Delete so you delete the row. Delete all rows. The "The list is empty" label will appears.
Let me know
Have a nice day
@AlessandroCaliaro So I looked at the code and it's a bit overwhelming heh...but it's what I asked for.I'm going try and see if I can dissect it on my own
It's not so difficult... Do you know mvvm? feel free to ask if you need help
@AlessandroCaliaro not really
take a look at @JamesMontemagno video
This thread is old, but maybe it'll help someone:
What I end up doing was
if ((MyList.ItemsSource as List<MyType>).Count == 0)
MyList.IsVisible = false;
EmptyMessage.IsVisible = true;
Where the ListView MyList and the Label EmptyMessage defined in the xaml,
and MyType is the type of the items used to create MyList.
It works perfectly fine for me
@Ofaim its working for me thanks!
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies