I recently wrote about a sort of StackPanel that I needed to write that would never show partial content if there was not enough room for that content. Well, I was about to write a new post with the code for it, which is working as well as expected, when I discovered a new need. I need a grid where one cell gets smaller as the entire grid gets smaller. But, once that cell gets to zero, I want some other specific cell to get smaller. I would call it a “PriorityGrid.” The whole idea behind these panels is to get the content that is most important to show up as completely as possible while controlling how the less-important content is displayed. I tried to get the desired effect with nested grids but it just doesn’t work.

I will try to show my code for the CullingStackPanel in my next post. There are interesting things going on with it that are worth writing about. But I might instead take the time to work on the PriorityGrid since I need it for my app.

I’m not sure if I can use Grid.RowDefinition or Grid.ColumnDefinition in my PriorityGrid without deriving from Grid. I will try to derive my class from Panel first and see how that goes. In the end, I suspect that I will end up with a property that is an array or a CSV list for the cell priorities. In fact, I think that I might even be able to combine the CullingStackPanel code into the PriorityGrid control so that cells that are shrinking and become too small to hold their content just become zero sized and the next priority cell gets larger to deal with the spacing.

On a side note, my posts are rather bland without pictures.