如何调整Windows边的WPF Scrollviewer棒

时间:2014-08-21 10:05:23

标签: c# wpf xaml

如何调整窗口侧的滚动查看器杆?请参考图表有更清晰的视觉效果。滚动条将相应地根据窗口调整大小。

enter image description here

    <ScrollViewer Height="600" HorizontalAlignment="Left" VerticalAlignment="Top">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="20" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <GroupBox Grid.Column="1" Header="A 1" HorizontalAlignment="Left" VerticalAlignment="Top">
            <StackPanel Orientation="Vertical">
                //GroupBox A
                //GroupBox B
                <StackPanel Orientation="Horizontal">
                    <GroupBox Header="C" Margin="0, 10, 0, 0" Width="600">
                        <Grid Margin="5, 0, 5, 0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120" />
                                <ColumnDefinition Width="105" />
                                <ColumnDefinition Width="35" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="120" />
                                <ColumnDefinition Width="105" />
                                <ColumnDefinition Width="35" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <TextBlock Grid.Row="0" Grid.Column="0" Text="D" Margin="0, 10, 0, 0" HorizontalAlignment="Left" VerticalAlignment="Center" />
                            <TextBox Grid.Row="0" Grid.Column="1" Margin="0, 10, 0, 0" Height="25" />

                            <Button Grid.Row="0" Grid.Column="4" Grid.RowSpan="2" Content="Okay" Margin="0, 10, 0, 0" Width="90" Height="25" HorizontalAlignment="Left" />
                        </Grid>
                    </GroupBox>
                </StackPanel>
            </StackPanel>
        </GroupBox>
    </Grid>
</ScrollViewer>

1 个答案:

答案 0 :(得分:1)

从XAML中的ScrollViewer中删除Horizo​​ntalAlignment =“Left”