如何显示画布wpf的滚动条

时间:2017-06-30 02:29:49

标签: wpf canvas drag-and-drop onmousemove

我从代码项目示例Drag controls in canvas

中实现了画布

此处用户可以在画布中的任何位置移动,当控件到达顶部或底部时,我想显示垂直滚动条。我怎样才能做到这一点?

1 个答案:

答案 0 :(得分:0)

<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Visible">
        <Grid  Name="grid">      
        <Canvas Name="canvastoExport" >           
            <Polygon Points="200,100,300,100,300,200,200,200" Fill="Green"></Polygon>            
        </Canvas>      
    </Grid>
    </ScrollViewer>