WPF ListBoxItem Visibility and ScrollBar
问题 I was hoping to collapse certain ListBoxItems based on a property of their data context. I came up with the following (trimmed for brevity) <ListBox ItemsSource="{Binding SourceColumns}"> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Style.Triggers> <DataTrigger Binding="{Binding IsDeleted}" Value="True"> <Setter Property="Visibility" Value="Collapsed"/> </DataTrigger> </Style.Triggers> </Style> </ListBox.ItemContainerStyle> <ListBox.ItemTemplate> <DataTemplate>