diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionCode.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionCode.bind
new file mode 100644
index 00000000000..33f73c51b56
--- /dev/null
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionCode.bind
@@ -0,0 +1,31 @@
+// Let's declare a sample enum
+public enum Animal
+{
+ Cat,
+ Dog,
+ Bunny,
+ Parrot,
+ Squirrel
+}
+
+// We can use a converter to get other values from our enum
+public sealed class AnimalToColorConverter : IValueConverter
+{
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ return (Animal)value switch
+ {
+ Animal.Cat => Colors.Coral,
+ Animal.Dog => Colors.Gray,
+ Animal.Bunny => Colors.Green,
+ Animal.Parrot => Colors.YellowGreen,
+ Animal.Squirrel => Colors.SaddleBrown,
+ _ => throw new ArgumentException("Invalid value", nameof(value))
+ };
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ throw new NotImplementedException();
+ }
+}
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml
new file mode 100644
index 00000000000..3ce0769f035
--- /dev/null
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml
@@ -0,0 +1,35 @@
+
+
+ Cat
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml.cs
new file mode 100644
index 00000000000..c3313a47588
--- /dev/null
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionPage.xaml.cs
@@ -0,0 +1,70 @@
+// 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 Windows.UI;
+using Microsoft.Toolkit.Uwp.UI.Extensions;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Data;
+using Microsoft.Toolkit.Uwp.SampleApp.Enums;
+
+namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
+{
+ ///
+ /// A page that shows how to use the type.
+ ///
+ public sealed partial class EnumValuesExtensionPage : IXamlRenderListener
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public EnumValuesExtensionPage()
+ {
+ InitializeComponent();
+ }
+
+ public void OnXamlRendered(FrameworkElement control)
+ {
+ }
+ }
+}
+
+#pragma warning disable SA1403 // File may only contain a single namespace
+namespace Microsoft.Toolkit.Uwp.SampleApp.Enums
+{
+ public enum Animal
+ {
+ Cat,
+ Dog,
+ Bunny,
+ Parrot,
+ Squirrel
+ }
+}
+
+namespace Microsoft.Toolkit.Uwp.SampleApp.Converters
+{
+ public sealed class AnimalToColorConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, string language)
+ {
+ return (Animal)value switch
+ {
+ Animal.Cat => Colors.Coral,
+ Animal.Dog => Colors.Gray,
+ Animal.Bunny => Colors.Green,
+ Animal.Parrot => Colors.YellowGreen,
+ Animal.Squirrel => Colors.SaddleBrown,
+ _ => throw new ArgumentException("Invalid value", nameof(value))
+ };
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, string language)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
+
+#pragma warning restore SA1403
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionXaml.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionXaml.bind
new file mode 100644
index 00000000000..b848cb4d075
--- /dev/null
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/EnumValuesExtension/EnumValuesExtensionXaml.bind
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json
index e24f1edd98a..aebab912a45 100644
--- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json
+++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json
@@ -1243,15 +1243,23 @@
"XamlCodeFile": "OnDeviceXaml.bind",
"DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/OnDeviceMarkup.md"
},
- {
- "Name": "IconExtensions",
- "Type": "IconExtensionsPage",
- "About": "Markup extensions to easily create various types of icons.",
- "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/Markup/FontIconExtension",
- "XamlCodeFile": "IconExtensionsXaml.bind",
- "Icon": "/Assets/Helpers.png",
- "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/IconExtensions.md"
- }
+ {
+ "Name": "IconExtensions",
+ "Type": "IconExtensionsPage",
+ "About": "Markup extensions to easily create various types of icons.",
+ "CodeUrl": "https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI/Extensions/Markup/FontIconExtension",
+ "XamlCodeFile": "IconExtensionsXaml.bind",
+ "Icon": "/Assets/Helpers.png",
+ "DocumentationUrl": "https://raw.githubusercontent.com/MicrosoftDocs/WindowsCommunityToolkitDocs/master/docs/extensions/IconExtensions.md"
+ },
+ {
+ "Name": "EnumValuesExtension",
+ "Type": "EnumValuesExtensionPage",
+ "About": "The EnumValuesExtension markup extension allows you to easily retrieve a collection of all values from an enum type.",
+ "Icon": "/Assets/Helpers.png",
+ "XamlCodeFile": "EnumValuesExtensionXaml.bind",
+ "CodeFile": "EnumValuesExtensionCode.bind"
+ }
]
},
{
diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Strings/en-US/Resources.resw b/Microsoft.Toolkit.Uwp.UI.Controls/Strings/en-US/Resources.resw
index 3654fbbe45c..923469a97ae 100644
--- a/Microsoft.Toolkit.Uwp.UI.Controls/Strings/en-US/Resources.resw
+++ b/Microsoft.Toolkit.Uwp.UI.Controls/Strings/en-US/Resources.resw
@@ -202,7 +202,7 @@
Narrator Resource for BladeView expanded status
- GridSpliter
+ GridSplitter
Narrator Resource for GridSplitter control
diff --git a/Microsoft.Toolkit.Uwp.UI/Extensions/Markup/EnumValuesExtension.cs b/Microsoft.Toolkit.Uwp.UI/Extensions/Markup/EnumValuesExtension.cs
new file mode 100644
index 00000000000..d697267485f
--- /dev/null
+++ b/Microsoft.Toolkit.Uwp.UI/Extensions/Markup/EnumValuesExtension.cs
@@ -0,0 +1,24 @@
+// 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 Windows.UI.Xaml.Markup;
+
+namespace Microsoft.Toolkit.Uwp.UI.Extensions
+{
+ ///
+ /// A markup extension that returns a collection of values of a specific
+ ///
+ [MarkupExtensionReturnType(ReturnType = typeof(Array))]
+ public sealed class EnumValuesExtension : MarkupExtension
+ {
+ ///
+ /// Gets or sets the of the target
+ ///
+ public Type Type { get; set; }
+
+ ///
+ protected override object ProvideValue() => Enum.GetValues(Type);
+ }
+}
diff --git a/UnitTests/UnitTests.UWP/App.xaml b/UnitTests/UnitTests.UWP/App.xaml
index c14ae170466..fedf12e5610 100644
--- a/UnitTests/UnitTests.UWP/App.xaml
+++ b/UnitTests/UnitTests.UWP/App.xaml
@@ -38,4 +38,9 @@
+
+
+
+ Cat
+
\ No newline at end of file
diff --git a/UnitTests/UnitTests.UWP/Extensions/Test_EnumValuesExtension.cs b/UnitTests/UnitTests.UWP/Extensions/Test_EnumValuesExtension.cs
new file mode 100644
index 00000000000..a46f6f7b864
--- /dev/null
+++ b/UnitTests/UnitTests.UWP/Extensions/Test_EnumValuesExtension.cs
@@ -0,0 +1,48 @@
+// 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.Toolkit.Uwp.UI.Extensions;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Markup;
+
+namespace UnitTests.Extensions
+{
+ [TestClass]
+ public class Test_EnumValuesExtension
+ {
+ [TestCategory("EnumValuesExtension")]
+ [UITestMethod]
+ public void Test_EnumValuesExtension_MarkupExtension()
+ {
+ var treeroot = XamlReader.Load(@"
+
+") as FrameworkElement;
+
+ var list = treeroot.FindChildByName("Check") as ListView;
+
+ Assert.IsNotNull(list, "Could not find listview control in tree.");
+
+ Animal[] items = list.ItemsSource as Animal[];
+
+ Assert.IsNotNull(items, "The items were not created correctly");
+
+ CollectionAssert.AreEqual(items, Enum.GetValues(typeof(Animal)));
+ }
+ }
+
+ public enum Animal
+ {
+ Cat,
+ Dog,
+ Bunny
+ }
+}
diff --git a/UnitTests/UnitTests.UWP/Properties/UnitTestApp.rd.xml b/UnitTests/UnitTests.UWP/Properties/UnitTestApp.rd.xml
index be5c4987ee3..98511bbba74 100644
--- a/UnitTests/UnitTests.UWP/Properties/UnitTestApp.rd.xml
+++ b/UnitTests/UnitTests.UWP/Properties/UnitTestApp.rd.xml
@@ -35,6 +35,7 @@
+
\ No newline at end of file
diff --git a/readme.md b/readme.md
index 23f2aacaa24..0db48418d7e 100644
--- a/readme.md
+++ b/readme.md
@@ -12,7 +12,7 @@ The Windows Community Toolkit is a collection of helper functions, custom contro
## Build Status
| Target | Branch | Status | Recommended package version |
| ------ | ------ | ------ | ------ |
-| Production | rel/6.0.0 | [](https://dev.azure.com/dotnet/WindowsCommunityToolkit/_build/latest?definitionId=10&branchName=rel/6.0.0) | [](https://www.nuget.org/profiles/Microsoft.Toolkit) |
+| Production | rel/6.1.0 | [](https://dev.azure.com/dotnet/WindowsCommunityToolkit/_build/latest?definitionId=10&branchName=rel/6.1.0) | [](https://www.nuget.org/profiles/Microsoft.Toolkit) |
| Pre-release beta testing | master | [](https://dev.azure.com/dotnet/WindowsCommunityToolkit/_build/latest?definitionId=10) | [](https://dotnet.myget.org/gallery/uwpcommunitytoolkit) |
## Getting Started