I have an public IEnumerable<ISlot> enumSlots;
.
Which is declared in my MainWindow and filled with values:
public MainWindow()
{
InitializeComponent();
enumSlots = GetSlots();
this.DataContext = this;
}
The ISlot:
public interface ISlot
{
int Number { get; }
string Name { get; }
}
I have a custom control:
<Style Selector="controls|CustomControlSlot">
<Setter Property="Template">
<ControlTemplate>
<StackPanel Orientation="Vertical">
<Label x:Name="labelNumber" Content="Number"/>
<Label x:Name="labelName" Content="Name"/>
</StackPanel>
</ControlTemplate>
</Setter>
</Style>
</Styles>
My goal is, that for each item in the IEnumerable a custom control with the filled labels is displayed in in MainWindow.