user1350555
user1350555

Reputation:

WPF control that automatically shrinks content when content is larger than container

Good morning,

I am creating a number of user controls in code on a WPF window.

is there a container control that I can add the usercontrols to that will automatically shrink the content to the size of the container.

I do not want the content to grow to the maximum available size only shrink uniform-ally.

I tried the stackpanel control in horizonal layout mode and whilst this seemed to be the way to go it only seems to overflow or clip the children (i.e scrollbars or hidden content off page).

what I need is for all of the content to be visible but resized once the maximum size is reached.

thanks in advance.

Dan.

Upvotes: 0

Views: 584

Answers (1)

user1350555
user1350555

Reputation:

Clemens provided the answer in the comments but i cannot accept a comment as an answer so have posted it here.

the answer is to create a ViewBox and then put a container (containing all of the controls) in the viewbox.

this now shrinks and grows exactly as required and doesnt clip.

thanks

Dan.

Upvotes: 1

Related Questions