开发者

Sizing of Panels

开发者 https://www.devze.com 2023-01-01 07:36 出处:网络
I\'m looking for an article or overview of WPF Panel types, that explains the sizing characters of each.For example, here are the panel types:

I'm looking for an article or overview of WPF Panel types, that explains the sizing characters of each. For example, here are the panel types:

http://msdn.microsoft.com/en-us/library/ms754152.aspx#Panels_derived_elements

I've learned (by experiment) that UniformGrid can be given a fixed height, or it can be "auto" where it expands to fit available space. That is great, but what I wanted was for Uniform Grid to shrink to fit its internal content (particularly content that is provided dynamically, at run-time). I don't think it has that ability. So I'd like to know either what other Panel I could use for that purpose, or what Panel I should nest the UniformGrid inside of.

But I don't just want an answer to that specific question. I want the sizing dynamics and capabilities of all the Panel types, in summary 开发者_如何学Cform, so I can make all these choices as needed. Online I find articles that cover only half the Panel types, and don't give as much information about sizing as I'm describing.

Anyone know the link (or book) that has the info I'm seeking?

p.s. Since I want the UniformGrid to shrink to the dynamic content I'm providing, I could just keep track of the total height of controls placed within, and then set the height of the UniformGrid. But it would be nice if WPF took care of this for me.


Like all WPF Panels the UniformGrid can infact fit to its internal content. Try this:

   <Grid>
      <UniformGrid HorizontalAlignment="Center" 
                   VerticalAlignment="Center" 
                   Background="Red">
         <Button>Hello</Button>
         <Button>Hello</Button>
         <Button>Hello</Button>
      </UniformGrid>
   </Grid>
0

精彩评论

暂无评论...
验证码 换一张
取 消