views:

547

answers:

1

hi there,

i want to display some information in a listview using the GridView. i have several GridViewColumns and everything works fine.

However, want the GridViewColumns content to have a VerticalAlignment (Top in this case) but the gridvewcolumn intself doesnt offer a VerticalContentAlignment dependency property. when using DisplayMemberBinding there is also no possibility to supply VerticalAlignment information.

When using a custom DataTemplate as Celltemplate, i can add a VerticalAlignment="top" dp to e.g. some textblock. however this does not work. is there any "nifty-grifty special magic trick" to fullfill this tasK? (

+6  A: 

You can apply this style to your ListView:

<Style TargetType="{x:Type ListView}">
    <Setter Property="ItemContainerStyle">
     <Setter.Value>
      <Style TargetType="ListViewItem">
       <Setter Property="VerticalContentAlignment" Value="Top"/>
      </Style>
     </Setter.Value>
    </Setter>
</Style>

HTH, Kent

Kent Boogaart