如何锚定两个数据网格?

时间:2022-12-11 13:44:24

I'm trying to put 2 datagrids side by side. I can't seem to anchor them to each other because when I try to anchor them, the arrow goes straight to the opposite side, thus, the datagrids overlaps each other when I maximize the window

我试着把两个datagrid放在一起。我似乎无法将它们彼此锚定,因为当我试图将它们锚定时,箭头直接指向另一边,因此,当我最大化窗口时,datagrid相互重叠

1 个解决方案

#1


0  

Try to contain both of them inside StackPanel with Orientation="Horizontal":

试着将它们都包含在堆叠面板中,方向=“水平”:

<StackPanel Orientation="Horizontal">
    <DataGrid></DataGrid>
    <DataGrid></DataGrid>
</StackPanel>

in order to set datagrids to "fill" parent controls you need to read this question - How to get controls in WPF to fill available space?

为了将datagrids设置为“填充”父控件,您需要阅读这个问题——如何在WPF中获取控件以填充可用空间?

#1


0  

Try to contain both of them inside StackPanel with Orientation="Horizontal":

试着将它们都包含在堆叠面板中,方向=“水平”:

<StackPanel Orientation="Horizontal">
    <DataGrid></DataGrid>
    <DataGrid></DataGrid>
</StackPanel>

in order to set datagrids to "fill" parent controls you need to read this question - How to get controls in WPF to fill available space?

为了将datagrids设置为“填充”父控件,您需要阅读这个问题——如何在WPF中获取控件以填充可用空间?