No, no, no people!! No resizing, no custom controls or worse, subclassing needed! Just create a style for ListBoxItem that that sets its Visibility property to 'Collapsed' and its 'IsEnabled' property to 'false' when the the ListBoxItem's IsSelected is false and the ListBox itself doesn't have focus. (Best way to do that is with a MultiTrigger.) Finally, set the listbox to auto-size to its contents. Done and done! And it's pure XAML too!
We use this technique to quickly 'filter' lists and even TreeViews quite effectively except we bind the visibility to an IsFiltered property in our ViewModel.
Best part, since you're not binding to an ObservableCollection that you're constantly adding and removing things from, any properties which are view-only (i.e. IsExpanded for instance) are exactly as you left them when the items are shown again, all without having to track them in the ViewModel! It's purely UI. All 'View'.
Did I mention it's pure XAML??? Oh... I did. Just making sure you know it's PURE XAML!!!
And again... make sure to set 'IsEnabled' to false when you hide the ListBoxItem (use a trigger or binding to do it for you) or your keyboard navigation will not work!