How to center image control inside a grid?

There is one grid, and I drop the Image control in the Grid. What I'm doing: just change the property - HorizontalAlignment and VerticalAlignment to "Center".

However, image management looks strange in contrast to other controls. This image management center is in line with its upper left corner, as shown below:

enter image description here

I want to know why it works this way?

EDIT Here is my XAML:

<UserControl x:Class="Entity.WPF.Controls.ShopProfile"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
         mc:Ignorable="d" 
         d:DesignHeight="600" d:DesignWidth="780">
<Grid>

    <DockPanel >
        <Grid>

            <Image  HorizontalAlignment="Center" Height="100" Margin="0" VerticalAlignment="Center" Width="100"/>
        </Grid>
    </DockPanel>
</Grid>

And if I set the margin, for example Margin = "- 50, -50,0,0", it is actually focused, but why do not other controls need this parameter?

+4
source share
1

, , , - .

, , , .

<Grid>
    <Image Height="100" Margin="0" Width="100" />
</Grid>

enter image description here

+1

All Articles