Lets have a class:
public partial class MyControl: UserControl{
private ObservableCollection<string> names =
new ObservableCollection<string>();
...
}
and then in XAML for the same UserControl
that is in XAML for class MyControl
:
<UserControl x:Class="MyProject.MyControl" xmlns="..." xmlns:x="...">
<ItemsControl ItemsSource="{Binding ???????}" />
</UserControl>
Is it possible to replace ???????
by something that will bind ItemsSource
to the names
field in code behind? What is the right way to do it if there is a way ? If there is no way does names
have to be dependency property instead of just a field ?