microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.28k stars 675 forks source link

Improve ItemsWrapGrid #528

Closed HppZ closed 5 years ago

HppZ commented 5 years ago

Proposal: ItemsWrapGrid needs support for different size children

Summary

I need use different ItemsContainers for different Models, different ItemsContainers have different sizes, their sizes are calculated based on factors like Model properties, Panel‘s size, Window's size or something else.

Rationale

support this feature makes ItemsWrapGrid more flexible and UWP apps more functional.

Functional Requirements

Important Notes

Open Questions

chrisglein commented 5 years ago

ItemsWrapGrid is only built to be a uniform grid. We have other ideas for layouts to expand our options here to hopefully meet your needs. @micahl can you wrap this into your existing feature requests and make sure it's covered?

msft-github-bot commented 5 years ago

We appreciate the feedback, however this doesn’t currently align to the project’s goals and roadmap and so will be automatically closed. Thank you for your contributions to WinUI!

micahl commented 5 years ago

@HppZ, are there examples of the kind of layout you're targeting? Is the size of the items independent from all the others (e.g. the main view in the Photos app), or is the expectation that if they change size based on some factors like those you mention that they all change equally (e.g. a grid view of album art that adapts to window resizes)?

HppZ commented 5 years ago

1, Here is my example code: https://github.com/HppZ/LayoutApp

2, The Photos app's panel is not one of those panels in UWP API, right?

micahl commented 5 years ago

No there isn't a virtualizing panel in UWP that already provides the layout of the Photos app. Is that the kind of layout you're trying to achieve where each item can be a different size? Or does the variable item size not matter in your scenario and you're just interested in having the equally sized items be able to stretch to fill the available space for things like window resizing?

HppZ commented 5 years ago

Yes, I want each item to have a different size. just like the layout in my example code: I want show 4 folder items per row & 5 photo items per row, and they are grouped.

micahl commented 5 years ago

This may be a lower-level than what you're asking for, but take a look at the new ItemsRepeater control. We ship two virtualizing layouts with ItemsRepeater that are discussed in that doc. Both of them are optimized cases of a more general kind of wrapping layout for variable height/width items we call FlowLayout.

It sounds like that might be what you're after. We don't currently include it in the official Nuget release. But, if you want to give it a try it's available to try in the recent prerelease versions of the Nuget package. Here's a small sample for it since it isn't well documented at this point. If you do try it, please give us feedback.

HppZ commented 5 years ago

some screenshots to illustrate what I want to do. s1 s2 s3

HppZ commented 5 years ago

closed? @micahl @YuliKl