inside TestEntryView.xaml.cs
public partial class TestEntryView : UserControl
{
public ObservableCollection<TestFieldView> Fields {get;set;}
...
}
where TestFieldView is a UserControl.
<UserControl x:Class="STS2Editor.View.TestEntryView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vw="clr-namespace:STS2Editor.View"
mc:Ignorable="d"
x:Name="testEntryView"
d:DesignHeight="300"
d:DesignWidth="427"
d:DataContext="{Binding TestEntry, Source={StaticResource Sample}}">
<Grid Background="{DynamicResource ButtonNormalBorder}" TextElement.Foreground="{DynamicResource TextBrush}">
<Border Background="{DynamicResource ControlBackgroundBrush}" BorderBrush="{DynamicResource ControlBackgroundBrush}" BorderThickness="4" CornerRadius="16">
<Grid Margin="4" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ScrollViewer Background="{DynamicResource ControlBackgroundBrush}" Grid.IsSharedSizeScope="True" Grid.Row="1">
<ItemsControl x:Name="fieldList" ItemsSource="{Binding Fields, ElementName=testEntryView}"/>
</ScrollViewer>
</Grid>
</Border>
</Grid>
The binding is right, but when I snoop the visual tree my child items all consist of a border and content presenter, no child visuals.