有没有办法自动使画布滚动溢出在WPF? [英] Is there a way to automagically make a canvas scroll on overflow in WPF?

查看:193
本文介绍了有没有办法自动使画布滚动溢出在WPF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

检查网络和此网站,但无法找到任何下降结果。

Been checking the web and this site, but couldn't come up with any descent results.

有一种方法可以使WPF中的画布显示滚动条溢出?尝试scrollviewer,但不能让它工作:(

Is there a way to make a canvas in WPF show scrollbars on overflow ? Been trying the scrollviewer, but can't get it to work :(

提前感谢..

推荐答案

你遇到的问题是,Canvas与许多WPF面板和容器不同,它不会与内容相匹配,这意味着如果添加一个超出canvas边界的元素,因此,在ScrollViewer中嵌入一个Canvas不会有好处,除非你手动更新Canvas的大小。

The problem you're running into is that Canvas, unlike many WPF panels and containers, does not size to contents. That means if you add an element which goes outside the canvas boundaries it will not update it's size. Hence embedding a Canvas in a ScrollViewer will do no good unless you manually update the size of the Canvas.

这听起来像你想要的是一个Canvas

It sounds like what you want is a Canvas which supports size to contents. This blog entry has exactly that control.

http://themechanicalbride.blogspot.com/2008/11/auto-sizing-canvas-for-silverlight-and.html

这篇关于有没有办法自动使画布滚动溢出在WPF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆