Ordinarily I would say use an ItemsControl
in conjunction with a Canvas
:
<ItemsControl ItemsSource="{Binding Ellipses}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemsContainerStyle>
<Style>
<Setter Property="Canvas.Left" Value="{Binding Left}"/>
<Setter Property="Canvas.Top" Value="{Binding Top}"/>
</Style>
</ItemsControl.ItemsContainerStyle>
</ItemsControl>
But in a display of Silverlight suckiness, the ItemContainerStyle
property does not work on ItemsControl
. It has support in ItemsControl
, but it's not exposed by ItemsControl
itself. Instead, it's up to subclasses of ItemsControl
- such as ListBox
- to expose it. Oh, and those subclasses have to be provided by Microsoft because the functionality is protected internal
, so you can't just subclass ItemsControl
and expose this stuff yourself. :S
So you could use ListBox
instead, possibly by subclassing it and changing its item container to something simpler than a ListBoxItem
. Or you could just use ListBox
directly and fiddle around until the ListBoxItem
s look the way you want them to (i.e. not selected).