Wednesday, June 26, 2013

DataGrid Content Vertical Alignment

Use the following style:

<Style x:Key="Body_Content_DataGrid_Centering"
        TargetType="{x:Type DataGridCell}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type DataGridCell}">
                <Grid Background="{TemplateBinding Background}">
                    <ContentPresenter VerticalAlignment="Center" />
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Found on http://stackoverflow.com/questions/3981250/datagrid-row-content-vertical-alignment

No comments:

Post a Comment