ScrollViewer在groupbox中不起作用? [英] ScrollViewer is not working inside groupbox?

查看:92
本文介绍了ScrollViewer在groupbox中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我是c#wpf的新手.我有一个问题,我想在我的Groupbox中包含ScrollViewer,但是它不能正常工作,我的代码是:

Hi guys i am new to c# wpf.I have a problem that i want to include ScrollViewer in my Groupbox but it is not working my code is :

<GroupBox 
           Margin="10,10,0,0"
            Grid.Row="0"
            Grid.ColumnSpan="3"
            Height="150"           
            >
                    <ScrollViewer>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>

                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="140"/>
                    <ColumnDefinition Width="120"/>
                    <ColumnDefinition Width="100"/>
                </Grid.ColumnDefinitions>

                <Label 
                    Margin="0,6,0,0"
                    Content="SSID"
                    Grid.Row="0"
                    >      
                </Label>

                <TextBox
                      Margin="0,6,0,6"
                    Grid.Column="1">

                </TextBox>

                <Label 
                     Margin="0,6,0,0"
                    Content="(1024)"
                    Grid.Column="2"
                    >
                </Label>
                <Label 
                     Margin="0,6,0,0"
                    Content="Authentication Mode"
                    Grid.Column="0"

                    Grid.Row="1"
                    >
                </Label>
                <ComboBox 
                        Margin="0,6,0,6" 
                Grid.Row="1"
                Grid.Column="1"
                ItemsSource="{Binding ACAvailableSecurityTypes}"
                SelectedItem="{Binding ACSelectedSecurityType}"
                />
                <Label

                      Margin="0,6,0,0"
                    Grid.Row="2"
                       Grid.Column="0"
                       Content="VLAN"
                      />

                <TextBox
                      Margin="0,6,0,6"
                    Grid.Row="2"
                    Grid.Column="1"
                    />

                <Label Grid.Row="2"
                       Grid.Column="2"
                    Content="(1-4094)"/>

                <Button
                    Grid.Row="3"
                    Grid.Column="2"
                    Content="Add SSID"
                    HorizontalAlignment="Left"
                    Width="70"
                    Style="{StaticResource AppButtons}"/>
            </Grid>
                    </ScrollViewer>
                </GroupBox>

任何帮助都是非常感激的.谢谢

Any help would be highly appreciable.Thanks

推荐答案

为了查看滚动条,您的 scrollviewer 的高度应小于组框的高度,这样做,您可以看到滚动条,设置高度 VerticalScrollBarVisibility

In Order to See your Scroll bar, your scrollviewer should have lesser height than your groupbox, do like this, you can see the scrollbar, Set the height and VerticalScrollBarVisibility

 <ScrollViewer Height="100" VerticalScrollBarVisibility="Auto">
            <GroupBox 
           Margin="10,10,0,0"
            Grid.Row="0"
            Grid.ColumnSpan="3"
            Height="150"           
            >
           ......

        </GroupBox>
 </ScrollViewer>

这篇关于ScrollViewer在groupbox中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆