Friday, August 7, 2009

How to set row height in WPF ListView

I've been checking out WPF lately for some prototyping work and came across something that's gotta be a very common show-stopper for beginners: I had a ListView element setup as a grid and no clue about how to set row height (without increasing font text - should go without saying).

This is a nice way of doing it (thanks stackoverflow):

<ListView>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Height" Value="50" />
</Style>
</ListView.ItemContainerStyle>
<!-- WHATEVER -->
</ListView>

That's what you get if you try to do some WPF magic without an Expression Blend license, which reminds me the good old days of editing html manually and feeling a God (except the God part).

2 comments:

Anonymous said...

Thnx, Iwas searching for this solution for a while and found it last........:)

Ruslan Inozemtsev said...

Yes. I spent more days finding this solution. Thank you so much.