Reputation: 15282
I'm looking at creating a panel that takes all the children and wraps them inside of a ViewBox so it can scale them down to a certain uniform size.
I'm not sure if this is even possible to do, but I thought I'd ask. The reason why I'm not sure if this is possible is because Panel's don't have any xaml associated to them. They measure and arrange children in code. Any tips?
After not being clear enough, I figure I'll be more specific:
I want a Panel because I want to arrange and measure my children.
I already got the measureoverride function working to find the average height/width, but I can't figure out how to scale them in my arrangeoverride.
Upvotes: 0
Views: 1051
Reputation: 2531
Even after your update, I agree with Markus. It doesn't seem you need a custom panel. What you need is an ItemsControl with UniformGrid as ItemsPanel and ViewBox as ItemsContainer. UniformGrid decides how your items container are arranged. ViewBox handles stretch and scale of each item.
Upvotes: 0
Reputation: 34240
You haven't completely specified how you want your panel to work so I can't give you a sample panel, but I can point you to a working panel that does something similar to what you want to do:
In the example you can see that we can simulate a Viewbox
by just scaling the children of the panel ourselves. As I mentioned, exactly how you want to scale them is up to you.
Upvotes: 2