-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more samples for the ConstrainedBox control (#141)
* Add more samples for the ConstrainedBox control * Super minor design tweak --------- Co-authored-by: Niels Laute <niels.laute@live.nl>
- Loading branch information
1 parent
c93b840
commit 917513c
Showing
10 changed files
with
114 additions
and
46 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
18 changes: 18 additions & 0 deletions
18
components/Primitives/samples/ConstrainedBox/ConstrainedBoxAspectSample.xaml
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,18 @@ | ||
<!-- 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. --> | ||
<Page x:Class="PrimitivesExperiment.Samples.ConstrainedBoxAspectSample" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:CommunityToolkit.WinUI.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:PrimitivesExperiment.Samples" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" | ||
mc:Ignorable="d"> | ||
|
||
<controls:ConstrainedBox VerticalAlignment="Top" | ||
AspectRatio="16:3"> | ||
<Image VerticalAlignment="Center" | ||
Source="ms-appx:///Assets/WestSeattleView.jpg" | ||
Stretch="UniformToFill" /> | ||
</controls:ConstrainedBox> | ||
</Page> |
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
25 changes: 25 additions & 0 deletions
25
components/Primitives/samples/ConstrainedBox/ConstrainedBoxMultipleSample.xaml
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,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. --> | ||
<Page x:Class="PrimitivesExperiment.Samples.ConstrainedBoxMultipleSample" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:brushes="using:CommunityToolkit.WinUI.Media" | ||
xmlns:controls="using:CommunityToolkit.WinUI.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:ui="using:CommunityToolkit.WinUI" | ||
mc:Ignorable="d"> | ||
|
||
<StackPanel Orientation="Horizontal"> | ||
<controls:ConstrainedBox x:Name="CheckerPattern" | ||
MinWidth="64" | ||
MaxWidth="512" | ||
AspectRatio="1:1" | ||
MultipleX="64"> | ||
<Image ui:UIElementExtensions.ClipToBounds="True" | ||
Source="ms-appx:///Assets/checker.png" | ||
Stretch="None" /> | ||
</controls:ConstrainedBox> | ||
<controls:ContentSizer HorizontalAlignment="Right" | ||
TargetControl="{x:Bind CheckerPattern}" /> | ||
</StackPanel> | ||
</Page> |
16 changes: 16 additions & 0 deletions
16
components/Primitives/samples/ConstrainedBox/ConstrainedBoxMultipleSample.xaml.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,16 @@ | ||
// 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 CommunityToolkit.WinUI.Controls; | ||
|
||
namespace PrimitivesExperiment.Samples; | ||
|
||
[ToolkitSample(id: nameof(ConstrainedBoxMultipleSample), "ConstrainedBox Multiple", description: $"A sample for showing how to use a {nameof(ConstrainedBox)} for a tile pattern.")] | ||
public sealed partial class ConstrainedBoxMultipleSample : Page | ||
{ | ||
public ConstrainedBoxMultipleSample() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
components/Primitives/samples/ConstrainedBox/ConstrainedBoxScaleSample.xaml
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,18 @@ | ||
<!-- 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. --> | ||
<Page x:Class="PrimitivesExperiment.Samples.ConstrainedBoxScaleSample" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:brushes="using:CommunityToolkit.WinUI.Media" | ||
xmlns:controls="using:CommunityToolkit.WinUI.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:ui="using:CommunityToolkit.WinUI" | ||
mc:Ignorable="d"> | ||
|
||
<!-- Set MaxHeight here as sample has infinite height which doesn't make sense for this scenario --> | ||
<controls:ConstrainedBox MaxHeight="512" | ||
ScaleX="0.8" | ||
ScaleY="0.5"> | ||
<Grid Background="{ThemeResource AccentFillColorDefaultBrush}" /> | ||
</controls:ConstrainedBox> | ||
</Page> |
16 changes: 16 additions & 0 deletions
16
components/Primitives/samples/ConstrainedBox/ConstrainedBoxScaleSample.xaml.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,16 @@ | ||
// 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 CommunityToolkit.WinUI.Controls; | ||
|
||
namespace PrimitivesExperiment.Samples; | ||
|
||
[ToolkitSample(id: nameof(ConstrainedBoxScaleSample), "ConstrainedBox Scale", description: $"A sample for showing how to use a {nameof(ConstrainedBox)} for percent buffers over margins.")] | ||
public sealed partial class ConstrainedBoxScaleSample : Page | ||
{ | ||
public ConstrainedBoxScaleSample() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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