控制WPF中的对齐

控制WPF中的对齐,wpf,panel,Wpf,Panel,我在WPF中设计了一个窗口,左侧有一个图像,图像旁边有两个按钮。 我将WindowState设置为Maximized 但是在运行应用程序时,b/w控件之间的间隙增大了。我想要的路线,因为它是在设计时。在windows应用程序中按原样操作,在wpf中,控件自动对齐 请帮我做这个,我是wpf的新手。面板能否解决此问题 Samplle <Window x:Class="AnalogCalibrationTool.Window1" xmlns="http://schemas.microsoft.c

我在WPF中设计了一个窗口,左侧有一个图像,图像旁边有两个按钮。 我将
WindowState
设置为
Maximized

但是在运行应用程序时,b/w控件之间的间隙增大了。我想要的路线,因为它是在设计时。在
windows应用程序中
按原样操作,在
wpf中,控件自动对齐

请帮我做这个,我是wpf的新手。
面板能否解决此问题

Samplle

<Window x:Class="AnalogCalibrationTool.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Analog Hardware Calibration Tool" 
    Height="500" 
    Width="700" 
    WindowStartupLocation="CenterScreen" 
    WindowStyle="SingleBorderWindow" 
    WindowState="Maximized" 
    ResizeMode="NoResize" SnapsToDevicePixels="True">
<Grid>
    <Image HorizontalAlignment="Left" Margin="84.436,164.428,0,147.763" Name="image1" Stretch="Fill" Width="200" />
    <Button Height="23" Margin="326.634,0,276.639,147.763" Name="button1" VerticalAlignment="Bottom">Button</Button>
    <Button Height="29.997" HorizontalAlignment="Right" Margin="0,0,184.426,144.264" Name="button2" VerticalAlignment="Bottom" Width="75">Button</Button>
</Grid>
</Window>

按钮
按钮
您可以尝试以下方法:

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Rectangle Name="image1" Width="200" Grid.Column="0" Fill="Aqua"  />
    <StackPanel Grid.Column="1" HorizontalAlignment="Left">
        <Button Name="button1" Height="23" Width="60" Content="Button1"/>
        <Button Name="button2" Height="23" Width="60" Content="Button2"/>
    </StackPanel>
</Grid>


在示例中,一个矩形被用作图像的赝品

提供一个XAML示例。您应该在特定的行和列中添加图像和按钮。看看