I'm trying to center an image inside a DataGrid Cell. I've tried all the current code at the same time and each "centering" solutions one at a time and still get the image centered in left.
<DataGrid ItemsSource="{Binding PhotoList, Mode=TwoWay, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
Grid.Row="1"
x:Name="dataGridPhotos"
Margin="5 5 5 5"
CanUserAddRows="False"
CanUserDeleteRows="True"
AutoGenerateColumns="False"
HorizontalContentAlignment="Center">
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Source="{Binding PhotoSource}"
Width="320px"
Height="240px"
Stretch="Uniform"
Margin="0"
HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
</DataGrid.CellStyle>
</DataGrid>