Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ScrollViewer is not working inside groupbox?

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>
like image 892
CodeSniper Avatar asked Dec 20 '22 14:12

CodeSniper


2 Answers

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>
like image 181
Sajeetharan Avatar answered Dec 28 '22 08:12

Sajeetharan


Place the ScrollViewer outside the GroupBox, not inside:

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

        ...
        ...

    </GroupBox>
</ScrollViewer>
like image 26
Grant Winney Avatar answered Dec 28 '22 07:12

Grant Winney