wasteam / waslibs

Windows App Studio WinRT XAML & UWP Libraries
MIT License
314 stars 133 forks source link

RecalculateLayout subtracts 5px per column #44

Closed trevordunn closed 8 years ago

trevordunn commented 8 years ago

I'm noticing that all columns have 5px subtracted from what their width should be. I think this is being done here:

https://github.com/wasteam/waslibs/blob/master/src/AppStudio.Uwp/Controls/ResponsiveGridView/ResponsiveGridView.cs#L168

What is the reasoning for this? In one column grids, it leaves 5 blank pixels on the right. With two column grids, 10px...three cols, 15px...etc.

trevordunn commented 8 years ago

Maybe that line should be this? Not entirely sure what the - 5 is trying to accomplish. ItemWidth = Math.Floor(containerWidth / _columns);

javitosanchez commented 8 years ago

The ResponsiveGridView control is a wrapper of a regular GridView. We need to substract some amount of space to handle the GridView margins. There is another implementation of the ResponsiveGridView control based on the Panel control here. Maybe it works better for you.

trevordunn commented 8 years ago

Yeah, but the moment a developer changes that margin with styling, this class incorrectly sizes its items. I think it should at least be more dynamic.

trevordunn commented 8 years ago

Side note: I've noticed that in the recently released UWPCommunity tools there's an AdaptiveGridView that is a copy of this. Should this class even exist in this repo anymore? Probably wouldn't make sense to maintain two (or three if you count the one in labs) of them.

trevordunn commented 8 years ago

Looks like someone else reported the same issue there. https://github.com/Microsoft/UWPCommunityToolkit/issues/219

k0st1x commented 8 years ago

@trevordunn are the products waslibs and UWPCommunityToolkit somehow related?

javitosanchez commented 8 years ago

@trevordunn, please use this implementation based on Panel and let me know if you have any issue.

trevordunn commented 8 years ago

@k0st1x Microsoft recently released UWPCommunityToolkit (see this blog article). I am unclear on their relationship (as I'm not involved in maintaining either repo, nor did the article say anything about this), however the article poster did mention in a comment that "Several of the AppStudio controls has been brought over and cleaned up." when asked "Is this a replacement for app studio?"

trevordunn commented 8 years ago

@javitosanchez yes, the Labs implementation seems to work better and doesn't have the hardcoded sizing issue.

JohnnyWestlake commented 8 years ago

I could be crazy, but that labs panel will break virtualization on the grid view if that is important to you (which it should be if you have multiple pages of data)

javitosanchez commented 8 years ago

The current implementation doesn't support virtualization. This is one of the reason of being under "labs" section. You can use it if you don't have a big amount of data or you haven't memory restrictions.

Or you can use the other implementation that do supports virtualization.