I want to databind a ListBox to a linked list
public class MyClass
{
public string MyText{ get; set; }
public MyClass PreviousItem{ get; set; }
}
I want to use an instance of MyClass as the datasource of a ListBox, to basically show a list of the MyClass instance and all it’s PreviousItems.
Of course binding to an instance of MyClass will result in only the topmost parent being shown. What would be the best approach for this?
Why do you need a custom implementation of a LinkedList in the first place? There is a .NET implementation already: System.Collections.Generic.LinkedList
Other than that, you have basically three options:
business logic, impement at least
IEnumerable in MyClass (like the .NET lists)
your items of MyClass and
puts them into an
ObservableCollection
convert your linked list to a
collectionType like
ObservableCollection