How to center text in a specific column in WPF ListView? How to center text in a specific column in WPF ListView? wpf wpf

How to center text in a specific column in WPF ListView?


Try to set HorizontalContentAlignment to Stretch for the ItemContainerStyle. Then it should work with either TextAlignment="Center" or HorizontalAlignment="Center" for the TextBlock

<ListView ItemsSource="{Binding Effects}">    <ListView.ItemContainerStyle>        <Style TargetType="ListViewItem">            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>        </Style>    </ListView.ItemContainerStyle>    <!--...--></ListView>