2015-05-22 25 views
0
<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" /> 

我的名单很长,所以我只显示前6如何让我的GroupBox/StackPanel滚动?

我的UI显示单选按钮,但它不断超越分组框中。那么我可以使StackPanel或GroupBox滚动吗?

我试着加入这个对我的StackPanel,但没有工作

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

回答

3

是的,可以。

在您的StackPanel附近包装ScrollViewer

<ScrollViewer> 
    <StackPanel> 
     ... 
    </StackPanel> 
</ScrollViewer> 
+0

WOW。我永远不会想到这一点。谢谢 –

+1

没问题。软件*很有趣,有时也很容易。 :-) –