How can I show "No records found" when there are no data in itemsource bound to a Listbox. If I add a new textbox it gives an exception as cannot add data to readonly collection.
Thanks and Regards, Kanaya
How can I show "No records found" when there are no data in itemsource bound to a Listbox. If I add a new textbox it gives an exception as cannot add data to readonly collection.
Thanks and Regards, Kanaya
You can have a Grid with a TextBox and the ListBox in front, if the ListBox has content it will hide the TextBox and/or Bind the Visbility to the Count property of your ObervableCollection with a converter.
instead of doing this. check the count and hide the listbox if there are zero records and show a textblock with the message.
how are you binding data to the source of the listbox? If its by databinding with a property in its viewmodel, then simply check that property for null or empty . This will serve the purpose.
Providing more info or code you are using can bring in more help.