把布局容器添加到ScrollViewer中,可以实现布局容器滚动的效果:代码如下:
Canvas tCanvas = new Canvas;
m_ScrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Disabled; m_ScrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible; m_ScrollViewer.Width = 150; m_ScrollViewer.Height = tHeight; m_ScrollViewer.Content = tCanvas;