This is a follow up question to this, which was answered.
Using the code
<ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
you can create a list where the items populate the list box in columns from left to right and the last item in a particular column is never cutoff (meaning if the item was to tall to fit, it is moved to the top of the next column). How could I now dynamically adjust the width of the ListBox to 'fit' it's items and get that same behavior horizontally. So suppose the following:
If, at a given height, there only needed to be one column to fit all of the items the width of the listbox should be the size of the width of the items.
Or, at a given height there needs to be four columns, it would need to be size to four times the width of the items.
Finally, say at a given height there needs to be more columns than the maximum allowed width of the ListBox, it would need to calculate how wide it should be so that the items in the columns that would not be able to fit were not truncated but just not shown until the user scrolled to the right.
Thanks for your help!!
EDIT:
I think a simpler way to phrase the above is that I'm looking for a way to avoid 'clipping' items in the list. I'd like to create a list that displays items in grid but where you wouldn't have to scroll because some items were partially covered and would require you to scroll to the right or left to see the remainder of that item (though the list could only be so wide or tall and if there were enough items you'd still need to scroll to see all of them, just any items you saw should be fully displayed). Also I only care about the initial drawing of the list. It doesn't have to 'snap' items to always fit but it should be able to be scrolled so that it fills the available space completely with the items it does display.
It seemed to me the key do doing this is to figure out the size of a list item at runtime and the size of the content container in the listbox and then you could adjust it to completely fit so many items at once before the list is initially drawn?
Thanks!