From 8bc06f17a8760a1c2f1ffff3c1c3c7b31a13b36d Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Tue, 19 Sep 2023 18:35:43 +0200 Subject: [PATCH 1/2] Adding switchpresenter sample --- .../samples/Segmented.Samples.csproj | 2 + components/Segmented/samples/Segmented.md | 6 ++ .../SegmentedSwitchPresenterSample.xaml | 101 ++++++++++++++++++ .../SegmentedSwitchPresenterSample.xaml.cs | 21 ++++ tooling | 2 +- 5 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 components/Segmented/samples/SegmentedSwitchPresenterSample.xaml create mode 100644 components/Segmented/samples/SegmentedSwitchPresenterSample.xaml.cs diff --git a/components/Segmented/samples/Segmented.Samples.csproj b/components/Segmented/samples/Segmented.Samples.csproj index 22a77fa2..9c12defe 100644 --- a/components/Segmented/samples/Segmented.Samples.csproj +++ b/components/Segmented/samples/Segmented.Samples.csproj @@ -7,6 +7,8 @@ + + diff --git a/components/Segmented/samples/Segmented.md b/components/Segmented/samples/Segmented.md index b9575e0c..5983db4e 100644 --- a/components/Segmented/samples/Segmented.md +++ b/components/Segmented/samples/Segmented.md @@ -27,3 +27,9 @@ The `Segmented` control is best used with 2-5 items and does not support overflo The `Segmented` control contains various additional styles, to match the look and feel of your application. The `PivotSegmentedStyle` matches a modern `Pivot` style while the `ButtonSegmentedStyle` represents buttons. To load these styles, make sure to add the `ResourceDictionary` as a resource (see `Page.Resources` sample below). > [!SAMPLE SegmentedStylesSample] + +## Segmented + SwitchPresenter + +The `Segmented` control can be combined with e.g. a `SwitchPresenter` to provide easy navigation and with limited XAML and no code-behind! + +> [!SAMPLE SegmentedSwitchPresenterSample] diff --git a/components/Segmented/samples/SegmentedSwitchPresenterSample.xaml b/components/Segmented/samples/SegmentedSwitchPresenterSample.xaml new file mode 100644 index 00000000..c131ccf5 --- /dev/null +++ b/components/Segmented/samples/SegmentedSwitchPresenterSample.xaml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/Segmented/samples/SegmentedSwitchPresenterSample.xaml.cs b/components/Segmented/samples/SegmentedSwitchPresenterSample.xaml.cs new file mode 100644 index 00000000..032c5c29 --- /dev/null +++ b/components/Segmented/samples/SegmentedSwitchPresenterSample.xaml.cs @@ -0,0 +1,21 @@ +// 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 SegmentedExperiment.Samples; + +/// +/// An example sample page of a Segmented control. +/// + +[ToolkitSample(id: nameof(SegmentedSwitchPresenterSample), "Segmented + SwitchPresenter", description: $"A sample for showing how to create and use a {nameof(Segmented)} control in combination with a SwitchPresenter.")] +public sealed partial class SegmentedSwitchPresenterSample : Page +{ + public SegmentedSwitchPresenterSample() + { + this.InitializeComponent(); + } +} + diff --git a/tooling b/tooling index 5252507a..83c36da7 160000 --- a/tooling +++ b/tooling @@ -1 +1 @@ -Subproject commit 5252507af3c32949ca03e2970d5c50f881f11eea +Subproject commit 83c36da7a4dd3518362a5edddacf622e478517be From bdfaaf3e7a296f13d50b32b6af376395d4c27d63 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Wed, 31 Jan 2024 11:27:37 +0100 Subject: [PATCH 2/2] Update references --- components/Segmented/samples/Segmented.Samples.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Segmented/samples/Segmented.Samples.csproj b/components/Segmented/samples/Segmented.Samples.csproj index ee50a7b8..fa35cd4b 100644 --- a/components/Segmented/samples/Segmented.Samples.csproj +++ b/components/Segmented/samples/Segmented.Samples.csproj @@ -7,8 +7,8 @@ - - + +