I have a UserControl
which I\'m using to display a list of UIElement
s. The control consists of a single ItemsControl
with it\'s
Nir is correct, ItemsControl
will add item directly to its Panel
if they are UIElements. I couldn't find any mention of this behavior in MSDN, but Dr. WPF mentions it in his article on item containers:
If a UIElement is added to the Items collection of an explicit ItemsControl instance (as opposed to an instance of a derived class like ListBox), it will become a direct child of the items panel. If a non-UIElement is added, it will be wrapped within a ContentPresenter.
Your solution is probably to use a ListBox
instead, and set ItemContainerStyle
to a new Style
for ListBoxItem
, and in that style, use a ControlTemplate
with your Border
in it.