You can’t do this in Binding the Data for ListBox in XAML

During the Binding of the Data to the ListBox , it is only possible to bind the public properties to the ItemSource .

You can’t do this in Binding the Data for ListBox

If you are binding the public fields to the Listbox , you might not see the actual data 🙁

For example

public class Movie
{
	public string Name;
	public string Actor;
}

and create a List of Movie and assign it to the ItemSource Property of the Listbox , you will see the Listbox will be empty .

To get it to work , you should modify this to the Property like

public class Movie
{
	public string Actor { get; set; }
	public string Name { get; set; }
}

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...