I’m trying to bind to a collection of controls I generate dynamically:
<ItemsControl ItemsSource="{Binding CustomFields}">
And the code:
public ObservableCollection<Control> CustomFields
{
get
{
return GetCustomFields();
}
}
The Getcustomfields just generates some controls like a ComboBox, textbox etc. The binding seems to work, but the window doesn’t show any of my controls. Probably because I need an datatemplate in the itemscontrol. My question is what kind of datatemplate do I need?
Thanks for any help
The following property like with the same XAML as you use:
Maybe your problem comes from somewhere else… Can you give us the code needed to reproduce the problem ?