0

目前我尝试通过将 StackPanel 从属于我的 ScrollViewer 来向我的 StackPanel 添加一个垂直滚动条。但是有了这个“解决方案”,我的 StackPanel 中的内容消失了,而且我也没有滚动条。

我的 XAML:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="12*"/>
        <RowDefinition Height="77*"/>
        <RowDefinition Height="207*"/>
        <RowDefinition Height="23*"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="12*"/>
        <ColumnDefinition Width="436*"/>
        <ColumnDefinition Width="153"/>
    </Grid.ColumnDefinitions>

    <ListView x:Name="lv_Addresses" Grid.Column="1" Grid.Row="1" Grid.RowSpan="2">
        <ListView.View>
            <GridView>
                <GridViewColumn/>
            </GridView>
        </ListView.View>
    </ListView>

    <StackPanel Grid.Column="2" Grid.Row="1" Margin="0,0,0,10">
        <Label     x:Name="lbl_Search"    Margin="3,0,12,0" Content="Suche"/>
        <TextBox   x:Name="tbx_Search"    Margin="6,0,12,0"/>
        <Rectangle x:Name="rct_Separator" Margin="0,18,0,0" HorizontalAlignment="Stretch" Fill="Gray" Height="3"/>
    </StackPanel>

    <ScrollViewer VerticalScrollBarVisibility="Visible">
        <StackPanel Grid.Column="2" Grid.Row="2" Margin="0,0,0,10" >
            <Label     x:Name="lbl_SName"     Margin="3,0,12,0" Content="Nachname"/>
            <TextBox   x:Name="tbx_SName"     Margin="6,0,12,0"/>
            <Label     x:Name="lbl_FName"     Margin="3,0,12,0" Content="Vorname"/>
            <TextBox   x:Name="tbx_FName"     Margin="6,0,12,0"/>
            <Label     x:Name="lbl_Plz"       Margin="3,0,12,0" Content="Postleitzahl"/>
            <TextBox   x:Name="tbx_Plz"       Margin="6,0,12,0"/>
            <Label     x:Name="lbl_Location"  Margin="3,0,12,0" Content="Ort"/>
            <TextBox   x:Name="tbx_Location"  Margin="6,0,12,0"/>
            <Label     x:Name="lbl_Street"    Margin="3,0,12,0" Content="Straße"/>
            <TextBox   x:Name="tbx_Street"    Margin="6,0,12,0"/>
        </StackPanel>
    </ScrollViewer>
</Grid>
4

1 回答 1

0

将 StackPanel 放入 ScrollViewer 后,Grid.Column="2" Grid.Row="2"在 ScrollViewer 上进行设置。否则它进入 (0; 0) 网格单元格

于 2017-11-30T15:24:23.333 回答