I am 开发者_JAVA技巧creating a portal type dashboard for our app. The controls are added on the fly. I have a page, with a tabcontrol. In the tab control I add TabItems on the fly with a canvas on it. The canvas handles the mouse events to move the controls around.
I need to allow the users to create a layout bigger than the current size of the tab item... so I inserted a scrollviewer in the tab item and put the canvas onto it. However, the canvas doesn't seem to expand automatically to contain the content.
How can I made the canvas expand to hold all its content within the scroll viewer which will allow me to scroll around the canvas it contains?
Check these two previous SO posts on how to manipulate the size of a Canvas:
- Force a custom WPF Control to resize correctly
- WPF: How to make canvas auto-resize?
精彩评论