gray laptop computer showing html codes in shallow focus photography

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’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...