I am trying to set a border to each item from a items control. Following is my XAML code. But this doesn’t work.
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Control.BorderThickness" Value="5" />
<Setter Property="Control.BorderBrush" Value="Black" />
</Style>
</ItemsControl.ItemContainerStyle>
The container in an
ItemsControlis aContentPresenterwhich is not a control, this style will not do anything. You could create anItemsTemplatecontaining aBorder.Alternatively you can change the
ContentTemplatein theItemContainerStyle:(Note: This is a real alternative in the sense that it does the exact same thing, so i would use the
ItemTemplateas it is a lot less verbose, saves you three tags (Style,Setter,Setter.Value))