Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GridViewColumn content and VerticalAlignment

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? (

like image 226
Joachim Kerschbaumer Avatar asked Oct 07 '08 07:10

Joachim Kerschbaumer


1 Answers

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>
like image 148
Kent Boogaart Avatar answered Oct 08 '22 23:10

Kent Boogaart