简体   繁体   中英

how to make my GroupBox/StackPanel scrollable?

<GroupBox x:Name="groupBox1" Header="Item1" HorizontalAlignment="Left" Margin="10,94,0,0" VerticalAlignment="Top" Height="179" Width="280">
            <StackPanel>
                <RadioButton GroupName="County" Content="County1" IsChecked="True"/>
                <RadioButton GroupName="County" Content="County2" />
                <RadioButton GroupName="County" Content="County3" />
                <RadioButton GroupName="County" Content="County4" />
                <RadioButton GroupName="County" Content="County5" />
                <RadioButton GroupName="County" Content="County6" />

My list is very long so I only show the first 6

My UI shows the RadioButton but it keeps going beyond the GroupBox. So Can I make the StackPanel or GroupBox scrollable?

I've tried adding this to my StackPanel but didnt work

<StackPanel ScrollViewer.VerticalScrollBarVisibility="Auto" CanVerticallyScroll="True">

Yes, you can.

Wrap a ScrollViewer around your StackPanel .

<ScrollViewer>
   <StackPanel>
      ...
   </StackPanel>
</ScrollViewer>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM