Why Does ItemsControl Not Use My ItemTemplate?

前端 未结 2 1109
挽巷
挽巷 2020-12-11 02:36

I am able to use an ItemTemplate within an ItemsControl to render items in a specific format. However, if one of the items within the ItemsControl happens to be, say, a Tex

2条回答
  •  自闭症患者
    2020-12-11 03:01

    I'm just speculating here, but I would bet that it's behavior that lives inside of the ItemContainerGenerator. I'd bet that the ItemContainerGenerator looks at an item, and if it's a UIElement it says, "cool, the item container's been generated, I'll just return it" and if it's not, it says, "I'd better generate a container for this item. Where's the DataTemplate?"

提交回复
热议问题