Style within DataTemplate is only being applied to the last item in ItemsControl?

前端 未结 2 1820
太阳男子
太阳男子 2020-12-10 14:03

In the XAML below, I have an ItemsControl that has three DataObjects.
I use a DataTemplate to display DataObjects as Buttons with an \"X\" on them.
The Button uses a

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 14:43

    The answer to this is rather simple actually, every visual can only be the child of one object, unlike text like "X" which is just data.

    If you create a style like this: