views:

13

answers:

1

I am using a WrapPanel with an Image and Label, but the Label shows up to the right of the item. How can I make it show up at the bottom of the Image/Item?

<Window.Resources>
    <DataTemplate x:Key="ItemTemplate">
        <WrapPanel Orientation="Horizontal">
            <Image Width="50" Height="50" Stretch="Fill" Source="{Binding Cover}"/>
            <Label Content="{Binding Title}" />
        </WrapPanel>
    </DataTemplate>
</Window.Resources>
+1  A: 

Change:

Orientation="Horizontal"

To:

Orientation="Vertical"

I don't think any further explanation is needed!

Groky
Thanks Groky. It works. Now I noticed the vertical alignment is done by the label size. How can I make them aligned by center? So the Covers don't look they aren't ordered?
Joan Venge
Adding HorizontalAlignment="Center" to the WrapPanel should do it, if I understand you correctly.
Groky
Also another problem I have is I am using WrapPanel to have icons fill the ListView both by width and height, just like windows explorer folder windows. But now all of them are listed just as a single vertical line. Can I make it fill the entire view like this? http://www.functionx.com/visualc/applications/images/explorer1.gif
Joan Venge
You'll need to use a WrapPanel for the ListView's ItemsPanel: http://www.switchonthecode.com/tutorials/wpf-tutorial-using-an-itemspanel. Probably best to ask a new question if that article doesn't help.
Groky