Showing posts with label ItemContainerStyle. Show all posts
Showing posts with label ItemContainerStyle. Show all posts

Why doesn't my ControlTemplate get applied in the ItemContainerStyle?

Are the items you are adding to the control UIElements?

Took me ages until I found this obscure reference:

"The container for ItemsControl is normally a ContentPresenter, but if the child is a UIElement then it won't use a container. In this case, all of the children are Controls, so the ItemContainerStyle will apply to them directly. If you added an item other than a UIElement, that setter would set the Control.Template property on the ContentPresenter, which would succeed but have no effect."

http://stackoverflow.com/questions/3542381/specify-controltemplate-for-itemscontrol-itemcontainerstyle/3542399#3542399