Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF - How to make a ListView shrink to the height of the SelectedItem?

$
0
0

Hi All,


I am wanting to make a list view behave a little like a WPF ComboBox in that when an Item is Selected the ListView will shrink to the height of 1 item and scroll so that the selected item is the one in view.

From searching around i can find how to get the ListView to scroll but what i cant do is find out how to get the Height of an item in the ListVIew, in XAML so that I can bind the StoryBoard animation to it.

So the question is How Do You Bind to the Height of a ListViewItem in XAML?

A little history on why - I had a ComboBox with a DataTemplate that contained a Button and when the button was clicked it changed a property on the VM causing the Template to switch. This causes the ComboBox to close and the SelectedItem wont display the ItemTemplate when the ComboBox closes.

Any Help or a point in the right direction would be great

Thanks


Viewing all articles
Browse latest Browse all 18858

Trending Articles