I have a listbox where the items are styled using a ResourceDictionary style which is then attached to the ItemContainerStyle property. This gives my ListBoxItems a BorderThickness of let's say 1.
Now I want to collapse the items individually, so I use Visibility.Collapsed but for some reason the border that the ItemContainerStyle has created does not vanish with the rest of the list box item. It is as if it has created a layer behind my item and this remains despite the item being collapsed.
How do I set the ListBoxItem's (or this extra layer's) BorderThickness to 0 at run-time?
Regards sk