Using WPF I have a list of rectangles (which can have an undefined number of rectangles in it), and a canvas. I want to position those rectangles on the canvas using data bi
You need to account for the wrapping of the items when bound:
<ItemsControl ItemsSource="{Binding Data}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Canvas.Left" Value="{Binding X}"/>
<Setter Property="Canvas.Top" Value="{Binding Y}"/>
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate>
<!-- Item Template -->
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>