我想让一个滚动条放在堆栈面板上.滚动条显示但不允许用户移动滚动条.我的XMAL有问题还是有更多的东西?
<GroupBox HorizontalAlignment="Left" Margin="268,8,0,0" VerticalAlignment="Top" Width="505.881" Height="352.653" Header="Metrics">
<Grid>
<ScrollViewer>
<StackPanel>
</StackPanel>
</ScrollViewer>
</Grid>
</GroupBox>
Run Code Online (Sandbox Code Playgroud)
堆栈面板的内容是扩展器,其中包含数据.
ASa*_*nch 22
您不能设置GroupBox的宽度和高度,以使内部ScrollViewer工作.试试这个,你会发现它会正常工作.
<GroupBox Header="Metrics" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="268,8,0,0">
<Grid>
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel>
<Expander Header="Expander">
<StackPanel>
<Button>Test</Button>
<Button>Test</Button>
<Button>Test</Button>
<Button>Test</Button>
<Button>Test</Button>
<Button>Test</Button>
<Button>Test</Button>
<Button>Test</Button>
<Button>Test</Button>
</StackPanel>
</Expander>
</StackPanel>
</ScrollViewer>
</Grid>
</GroupBox>
Run Code Online (Sandbox Code Playgroud)