Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new WrapLayout and StaggeredLayout controls #3160

Merged
merged 119 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
2b5eb6c
Update dev/7.0.0 branch version number
michael-hawker Jan 31, 2020
1250f2f
Add a new project for layout controls
skendrot Feb 10, 2020
ec3cca8
First port of the StaggeredPanel to the new StaggeredLayout
skendrot Feb 10, 2020
04677f4
Create a new class that will hold layout information
skendrot Feb 10, 2020
7b6c797
Early exit if we don't have any items
skendrot Feb 10, 2020
e42a770
Early exit for no realization area to render to
skendrot Feb 10, 2020
5f8de42
Don't work with the UIElement directly within the measure method. Ins…
skendrot Feb 10, 2020
3a1a714
Stop measuring elements when we are outside the realization rect
skendrot Feb 10, 2020
225a24f
Track the top of the element on the StaggeredItem
skendrot Feb 10, 2020
98c3be0
Track the column layout and use that to arrange the items after measure
skendrot Feb 10, 2020
78673db
Make sure the top of the elemet accounts for the spacing between items
skendrot Feb 10, 2020
3bddce4
Move the column width to the state
skendrot Feb 10, 2020
5615681
Remove horizontal alignment calculations. I don't believe this should…
skendrot Feb 10, 2020
57a1e60
No need to arrange anything if there is no realization bounds
skendrot Feb 10, 2020
d2ee3f5
No need to keep arranging if we are outside the bounds
skendrot Feb 10, 2020
3814bcb
Return the column for the given index
skendrot Feb 10, 2020
b6a25e5
Return the final size always
skendrot Feb 10, 2020
9eed9df
Get the item in the column layout, not the index
skendrot Feb 10, 2020
becb6e4
Stop measuring after we have measured all columns that fit the bounds
skendrot Feb 10, 2020
d8b1c56
If the column width is different from what was previously there then …
skendrot Feb 10, 2020
c442431
Manually recycle elements that fall outside of the bounds
skendrot Feb 10, 2020
a6c3375
since we are staying within one column we do not need to track the he…
skendrot Feb 11, 2020
2b66a46
Make sure we remove the state
skendrot Feb 11, 2020
7767b7c
Rename method to clear all the things
skendrot Feb 11, 2020
3931d9d
When the width of the panel changes we could get more columns to use.…
skendrot Feb 11, 2020
a52d4ab
We ALWAYS want to measure an item that will be in the bounds
skendrot Feb 11, 2020
a64783a
Calculate the height based on the number of average number of items w…
skendrot Feb 11, 2020
9899415
Remove manual recycling logic
skendrot Feb 11, 2020
3a8ab88
Remove padding property to be in line with the WinUI layouts
skendrot Feb 11, 2020
fe0b6c3
Little code Clean up
skendrot Feb 11, 2020
235d5a6
Add some comments
skendrot Feb 11, 2020
7722f47
Remove method not used anymore
skendrot Feb 11, 2020
97fa156
We've already calculated the top. Use that value for placement
skendrot Feb 11, 2020
042d970
Remove items from the layout state when an item is removed from the l…
skendrot Feb 11, 2020
aefd2e0
Clear the columns after the removal item
skendrot Feb 11, 2020
0d2f5bb
We don't need to clear any of the cache if the an item was added/remo…
skendrot Feb 11, 2020
6415124
Clear cached items when an item is added
skendrot Feb 11, 2020
33305e1
Clear the entire cache when the collection has been reset
skendrot Feb 11, 2020
519cfb1
No need to calculate the number of columns. We have it in our layout …
skendrot Feb 11, 2020
b49dc3a
First port of the WrapPanel to be a Layout
skendrot Feb 11, 2020
38e81fe
Stop measuring items when we are outside the bounds
skendrot Feb 11, 2020
975dc7b
Only arrange items within the bounds
skendrot Feb 12, 2020
97a2813
The bottom of the items needs to be within the top bounds.
skendrot Feb 12, 2020
72a39b5
Keep track of the element measure and only get the element when we ne…
skendrot Feb 12, 2020
fb3ae65
break out of the arrange when we have passed the realization bounds
skendrot Feb 12, 2020
8d64299
Always measure items that are within the bounds
skendrot Feb 12, 2020
68dc5e5
Add the <inheritdoc /> tag
skendrot Feb 12, 2020
07cee0b
Clear items when the collection changes
skendrot Feb 12, 2020
3e6b7a3
When the Orientation changes, clear the cache
skendrot Feb 12, 2020
7e5a391
No need to clear the entire collection. We can just switch the values
skendrot Feb 12, 2020
5e226e1
Only check if we're past the bounds when we move to the next row
skendrot Feb 12, 2020
f4a52dd
Remove Padding to be in line with the WinUI Layouts
skendrot Feb 12, 2020
6b4f54e
Add debugger info
skendrot Feb 13, 2020
89e08cd
Store the position of items instead of calculating each time
skendrot Feb 18, 2020
d7d4171
Reset the position of items whenever a layout property changes
skendrot Feb 18, 2020
2a14977
Clear positions whenever the available U value changes
skendrot Feb 18, 2020
a940e55
Clear the available U whenever orientation changes
skendrot Feb 18, 2020
1d8d591
Remove property not used
skendrot Feb 18, 2020
711bfc4
Make sure to null the position when orientation changes
skendrot Feb 18, 2020
6ae10be
Remove the attached property and store the spacing in the state
skendrot Feb 18, 2020
100bff8
Calculate the height of the items
skendrot Feb 18, 2020
5808401
Don't average items that haven't had their position calculated yet
skendrot Feb 18, 2020
4d911e2
Fix type in variable
skendrot Feb 18, 2020
e09227b
Make sure elements get recycled when they are outside the scope of th…
skendrot Feb 19, 2020
592a645
Ignore row spacing for determining which column an items goes to
skendrot Feb 19, 2020
4118bdd
This array holds ints, not doubles
skendrot Feb 19, 2020
1ed9fa4
Add height to the debugger display
skendrot Feb 19, 2020
e87a85b
We need to recalculate the height when the RowSpacing changes
skendrot Feb 19, 2020
4ea0ada
Revert the change to not account for row spacing when finding the col…
skendrot Feb 19, 2020
26ba303
Use the laest version of WinUI
skendrot Feb 20, 2020
9e7b442
Make sure elements that are above the bounds are recycled
skendrot Feb 20, 2020
2828d13
Merge branch 'master' into Layouts
skendrot Mar 4, 2020
3e70dff
Recycle an element if it is below the bounds
skendrot Mar 9, 2020
4f3d484
Make method static
skendrot Mar 9, 2020
37d8f22
Add case handling for items being replaced
skendrot Mar 9, 2020
63e571f
Switch to a switch statement
skendrot Mar 9, 2020
b00beff
Add a comment as to what is happening when the height is zero
skendrot Mar 9, 2020
c657716
Add required space after brace
skendrot Mar 9, 2020
19f9fb0
Handle moving of items
skendrot Mar 9, 2020
d1c12a5
Recycle elements when they are replaced or moved to ensure the correc…
skendrot Mar 9, 2020
74c5ede
Switch to a swtich statement for the items changing
skendrot Mar 9, 2020
0c5298e
Merge branch 'master' into Layouts
Kyaa-dost Mar 9, 2020
978e3db
Add support for moving an item in the wrap layout
skendrot Mar 9, 2020
9b55f99
Do not clear the items from the collection. zero out their measure va…
skendrot Mar 9, 2020
da95ec7
Add handling for an item being replaced in the wrap layout
skendrot Mar 9, 2020
5d7164f
A move could effect the position of items after it. So just clear the…
skendrot Mar 9, 2020
60acd33
Merge branch 'Layouts' of https://github.com/skendrot/UWPCommunityToo…
skendrot Mar 9, 2020
0338d70
Add header to file
skendrot Mar 10, 2020
6a02450
Remove unused usings
skendrot Mar 10, 2020
15e924f
Add summary comment for the class
skendrot Mar 10, 2020
bf7c083
Add a simple WrapLayout sample
skendrot Mar 10, 2020
be13161
Add a simple sample for the new staggered layout
skendrot Mar 10, 2020
28e9c54
Put the property on different lines
skendrot Mar 12, 2020
cefad16
Remove trailing white space
skendrot Mar 12, 2020
1d5d9f3
Merge branch 'master' into Layouts
skendrot Mar 13, 2020
841a5a4
Remove empty Item group
skendrot Mar 13, 2020
85a2003
recycle elements that are below the bounds
skendrot Mar 13, 2020
10813b1
Merge branch 'Layouts' of https://github.com/skendrot/UWPCommunityToo…
skendrot Mar 13, 2020
be17557
Merge branch 'master' into Layouts
skendrot Mar 16, 2020
04c1c2c
Merge branch 'master' into Layouts
Kyaa-dost Mar 27, 2020
b1ac63e
Merge branch 'master' into Layouts
michael-hawker Apr 2, 2020
e22ac0e
Rename local method
skendrot Apr 2, 2020
11ad747
Merge branch 'master' into Layouts
skendrot Apr 13, 2020
2dbf136
Only measure an item if it wasn't already measured. This helps speed …
skendrot Apr 14, 2020
d366457
Increae the size of the items
skendrot Apr 14, 2020
7c6b626
Merge branch 'master' into Layouts
skendrot Apr 14, 2020
1880101
Add the location for code and documentation
skendrot Apr 14, 2020
d8d1918
Track the elements that are used and make sure they recycled when the…
skendrot May 6, 2020
91cf313
Merge branch 'master' into Layouts
skendrot May 6, 2020
4cb3d83
Merge branch 'master' into Layouts
Kyaa-dost May 13, 2020
a4e18e4
Change the category for the layouts
skendrot May 14, 2020
a3eef4a
When an item changes size we need to set a new height for the item an…
skendrot May 14, 2020
262275a
If the current measure of the item does not match then the size of th…
skendrot May 14, 2020
92abf24
Need to check changes in V also
skendrot May 14, 2020
25ed6d8
Just use the handy Equals method!
skendrot May 14, 2020
c092cf7
No need to remove items that are above index
skendrot May 14, 2020
d542dcc
Move items to a new row if the size makes them larger than the given …
skendrot May 14, 2020
b4e3abf
Merge branch 'master' into Layouts
skendrot May 14, 2020
aca6799
Merge branch 'master' into Layouts
Kyaa-dost May 15, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<Version>6.1.0-build.6</Version>
</PackageReference>
<PackageReference Include="Microsoft.UI.Xaml">
<Version>2.2.190917002</Version>
<Version>2.3.200213001</Version>
</PackageReference>
<PackageReference Include="Monaco.Editor">
<Version>0.7.0-alpha</Version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="MSBuild.Sdk.Extras">

<PropertyGroup>
<TargetFramework>uap10.0.18362</TargetFramework>
<TargetPlatformVersion Condition="'$(TargetPlatformVersion)' == '' ">10.0.18362.0</TargetPlatformVersion>
<Title>Windows Community Toolkit Layout</Title>
<Description>
This library provides XAML layout controls. It is part of the Windows Community Toolkit.
</Description>
<RootNamespace>Microsoft.Toolkit.Uwp.UI.Controls</RootNamespace>
</PropertyGroup>

<ItemGroup>
<None Include="VisualStudioToolsManifest.xml" Pack="true" PackagePath="tools" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.UI.Xaml" Version="2.3.200213001" />
skendrot marked this conversation as resolved.
Show resolved Hide resolved
</ItemGroup>

<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />

<!-- https://weblogs.asp.net/rweigelt/disable-warnings-in-generated-c-files-of-uwp-app -->
<Target Name="PragmaWarningDisablePrefixer" AfterTargets="MarkupCompilePass2">
<ItemGroup>
<GeneratedCSFiles Include="**\*.g.cs;**\*.g.i.cs" />
</ItemGroup>
<Message Text="CSFiles: @(GeneratedCSFiles->'&quot;%(Identity)&quot;')" />
<Exec Command="for %%f in (@(GeneratedCSFiles->'&quot;%(Identity)&quot;')) do echo #pragma warning disable &gt; %%f.temp &amp;&amp; type %%f &gt;&gt; %%f.temp &amp;&amp; move /y %%f.temp %%f &gt; NUL" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">

</wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Resources;
using System.Runtime.CompilerServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: InternalsVisibleTo("UnitTests")]
[assembly: NeutralResourcesLanguage("en-US")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
<Library Name="Microsoft.Toolkit.Uwp.UI.Controls.Layout">
</Library>
</Directives>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Collections.Generic;

namespace Microsoft.Toolkit.Uwp.UI.Controls
{
[System.Diagnostics.DebuggerDisplay("Count = {Count}, Height = {Height}")]
internal class StaggeredColumnLayout : List<StaggeredItem>
{
public double Height { get; private set; }

public new void Add(StaggeredItem item)
{
Height = item.Top + item.Height;
base.Add(item);
}

public new void Clear()
{
Height = 0;
base.Clear();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using Microsoft.UI.Xaml.Controls;
using Windows.Foundation;
using Windows.UI.Xaml;

namespace Microsoft.Toolkit.Uwp.UI.Controls
{
internal class StaggeredItem
{
public StaggeredItem(int index)
{
this.Index = index;
}

public double Top { get; internal set; }

public double Height { get; internal set; }

public int Index { get; }
}
}
Loading