-
Notifications
You must be signed in to change notification settings - Fork 705
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UniformGridLayout] Fix bug where controls would not know their limit…
…ations when being evaluated for layouting (#5359) * Add test code, fix bug * Refactor * Refactor code * CR feedback, refactor * CR feedback * Add non working test * Attempt to fix the test. * Fix build break * Add attribute * Make type public * Move namespace * Change namespace of type. Co-authored-by: Stephen Peters <[email protected]>
- Loading branch information
1 parent
8b7e40a
commit a4dcfc9
Showing
8 changed files
with
186 additions
and
17 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
dev/Repeater/APITests/Common/AspectRatioRespectingControl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.Foundation; | ||
using Windows.UI.Xaml.Controls; | ||
|
||
namespace MUXControls.ApiTests.RepeaterTests.Common | ||
{ | ||
[Windows.UI.Xaml.Data.Bindable] | ||
public class AspectRatioRespectingControl : ContentPresenter | ||
{ | ||
protected override Size MeasureOverride(Size availableSize) | ||
{ | ||
return TwoByOneifySize(availableSize); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override Size ArrangeOverride(Size finalSize) | ||
{ | ||
return TwoByOneifySize(finalSize); | ||
} | ||
|
||
private Size TwoByOneifySize(Size initialSize) | ||
{ | ||
if (Double.IsNaN(initialSize.Height) || Double.IsInfinity(initialSize.Height)) | ||
{ | ||
return new Size(initialSize.Width/ 2, initialSize.Width); | ||
} | ||
if (Double.IsNaN(initialSize.Width) || Double.IsInfinity(initialSize.Width)) | ||
{ | ||
return new Size(initialSize.Height / 2, initialSize.Height); | ||
} | ||
return new Size(Math.Min(100,initialSize.Height / 2), Math.Min(100,initialSize.Height)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters