XAML 在WinUI中缩小窗口时下移网格列

s6fujrry  于 2023-09-28  发布在  其他
关注(0)|答案(1)|浏览(76)

我有一个GridView,它有两个XAML中的静态宽度列。但第二列躲在窗外时,窗口缩小。如何使第二列下移动的第一列,而不是隐藏它的窗口?谢谢.

<Grid Background="White">
    <Grid.ColumnDefinitions>
        <ColumnDefinition/>
        <ColumnDefinition/>
    </Grid.ColumnDefinitions>
    <!-- first column-->
    <Grid Grid.Column="0">
        <ScrollViewer>   
            <StackPanel Orientation="Vertical">
               <!-- listview -->
            </StackPanel>
        </ScrollViewer>
    </Grid>
    <!-- second column -->
    <Grid Grid.Column="1">
        <ScrollViewer>
            <StackPanel Orientation="Vertical" Margin="5,10,0,0">
                <!-- listview -->
            </StackPanel>
        </ScrollViewer>
    </Grid>
</Grid>

更新:添加源代码

jmp7cifd

jmp7cifd1#

有一个名为GridView的控件:

<GridView>
    <GridView.ItemsPanel>
        <ItemsPanelTemplate>
            <ItemsWrapGrid
                MaximumRowsOrColumns="2"
                Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </GridView.ItemsPanel>
    <GridView.Items>
        <Button Content="Item 1" />
        <Button Content="Item 2" />
    </GridView.Items>
</GridView>

相关问题