It sounds like you haven’t assigned your DataContext. Below is a brief example.
Assuming your custom class looks something like this:
CODE:
public class Foo
{
private ObservableCollection<string> _names;
public ObservableCollection<string> Names
{
get{ return _names;}
set
{
_names = value;
}
}
}
and your XAML looks like
XAML:
<ListBox Name="lstNames" ItemsSource="{Binding Names}"/>
Set your DataContext in code behind.
lstNames.DataContext = new Foo();
This is a very simplistic version to achieve what you need. You should really have a look at Binding to Collections.
2
solved WPF binding to custom class with observable collection