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

In this post, you will learn about sync provider notifications in Windows 11 and how to disable or enable it...
In this tutorial, let’s learn how to enable or disable the startup sound in Windows 11. By default, when Windows...
The CameraCaptureTask allows the Windows Phone 7 App to launch the Camera Application . This will be useful when the...