当应用程序未在全屏模式下打开时,它工作得很好。但是,当我打开全屏时,我的按钮和“StudentsDataGrid”失去了它们的位置,我看不到它们在哪里。当我调整窗口大小时,按钮和 DataGrid 也会改变它们的位置。这里 xaml 是:
<Window x:Class="StudentsBoard.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="996" Width="1191"
xmlns:my="clr-namespace:Students" Loaded="Window_Loaded"
WindowStartupLocation="CenterScreen" WindowStyle="SingleBorderWindow"
ResizeMode="CanResize" SizeChanged="Window_SizeChanged" SizeToContent="Manual"
WindowState="Maximized">
<Grid Name="MainGrid" DataContext="{StaticResource StudentViewSource}">
<Button Content="..." Height="40" HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="1079,132,0,785" Name="btnbar_edit_student" Style="{DynamicResource GlassButtonBar}" Width="40" Click="btnbar_edit_student_Click" />
<Button Content="-" Height="40" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="1079,192,0,725" Name="btnbar_del_student" Style="{DynamicResource GlassButtonBar}" Width="40" Click="btnbar_del_student_Click" />
<DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" Height="177"
HorizontalAlignment="Left" VerticalAlignment="Top" ItemsSource="{Binding Source=
{StaticResource StudentViewSource}}" Margin="868,60,0,0" Name="StudentsDataGrid"
RowDetailsVisibilityMode="VisibleWhenSelected" Width="192"
MouseLeftButtonUp="StudentsDataGrid_MouseLeftButtonUp">
</DataGrid>
</Grid>
我希望元素保持完全相同的位置。决定是什么?