1

可能重复:
如何在 WPF ListView 的特定列中居中文本?

嗨,我们如何在 Wpf 的列表视图项目中将所有文本居中?

<ListView x:Name="FoldersListView" Margin="57,150,161,139" Style="{DynamicResource ListViewStyle1}" Background="#FFEDDEDE" IsSynchronizedWithCurrentItem="True">
        <ListView.View>
            <GridView>
                <GridViewColumn Header="Folder" Width="300" DisplayMemberBinding ="{Binding Path = FolderPath}" />

                <GridViewColumn Header="Status" Width="100" DisplayMemberBinding="{Binding Path = FolderStatus}"/>

            </GridView>
        </ListView.View>            
    </ListView>
4

1 回答 1

2

因为每列没有区别:

<ListView.ItemContainerStyle>
    <Style TargetType="ListViewItem">
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
    </Style>
</ListView.ItemContainerStyle>
于 2012-08-02T09:00:50.867 回答