I'm new to WPF and trying to databind shapes to a canvas. I have an observableCollection of "cake" objects in my viewmodel. I've managed to make databinding work and write a list with my cakeID's, but would like to add the cakes to a canvas as ellipses and from searching I've found itemsControl to be the only solution. As I have an observableCollection of cakes and not an observableCollection of objects I'm struggling to do this. Should I create the ellipse object in the cake object or can I just have the data and create it in XAML?
My XAML code looks like this, but I'm confused with what I should bind where, to retrieve the ellipse from the cake objects in the cake list, and the XPos and YPos
<DockPanel>
<Viewbox Margin="30,30,30,42">
<ItemsControl ItemsSource="{Binding Path=cakes}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas Name="canvasWorld" Background="Blue" Width="3996.0" Height="2009.1" IsItemsHost="True">
</Canvas>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Path Data="{Binding ellipse}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Canvas.Top" Value="{Binding Path=XPos}" />
<Setter Property="Canvas.Left" Value="{Binding Path=YPos}" />
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
</Viewbox>
</DockPanel>