diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index 3d4c0a45..fb852cfb 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -20,4 +20,4 @@ contact_links:
about: "The Windows Community Toolkit uses Uno Platform for cross-platform WinUI. See the Uno Platform repo for issues specific to running on non-Windows platforms:"
- name: Discord
url: https://aka.ms/wct/discord
- about: "Join the UWP Discord Server and talk to us in the #community-toolkit channel."
+ about: "Join the Windows App Community Discord Server and talk to us in the #community-toolkit channel."
diff --git a/components/Behaviors/src/CommunityToolkit.WinUI.Behaviors.csproj b/components/Behaviors/src/CommunityToolkit.WinUI.Behaviors.csproj
index 05f3c37b..402d7526 100644
--- a/components/Behaviors/src/CommunityToolkit.WinUI.Behaviors.csproj
+++ b/components/Behaviors/src/CommunityToolkit.WinUI.Behaviors.csproj
@@ -8,6 +8,7 @@
CommunityToolkit.WinUI.BehaviorsRnsReadMe.md
+ true
diff --git a/components/Collections/samples/AdvancedCollectionView.md b/components/Collections/samples/AdvancedCollectionView.md
index c2c37bd1..bab2750e 100644
--- a/components/Collections/samples/AdvancedCollectionView.md
+++ b/components/Collections/samples/AdvancedCollectionView.md
@@ -1,8 +1,8 @@
---
title: AdvancedCollectionView
author: nmetulev
-description: The AdvancedCollectionView is a collection view implementation that support filtering, sorting and incremental loading. It's meant to be used in a viewmodel.
-keywords: AdvancedCollectionView, data, sorting, filtering, Collections
+description: The AdvancedCollectionView is a collection view implementation that support filtering, sorting and incremental loading. It's meant to be used in a view or viewmodel.
+keywords: AdvancedCollectionView, CollectionViewSource, data, sorting, filtering, Collections
dev_langs:
- csharp
category: Helpers
@@ -12,11 +12,9 @@ issue-id: 0
icon: Assets/AdvancedCollectionView.png
---
-> [!Sample AdvancedCollectionViewSample]
-
## Usage
-In your viewmodel instead of having a public [IEnumerable](https://learn.microsoft.com/dotnet/core/api/system.collections.generic.ienumerable-1) of some sort to be bound to an eg. [Listview](https://learn.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.ListView), create a public AdvancedCollectionView and pass your list in the constructor to it. If you've done that you can use the many useful features it provides:
+In your view or viewmodel instead of having a public [IEnumerable](https://learn.microsoft.com/dotnet/core/api/system.collections.generic.ienumerable-1) of some sort to be bound to an eg. [Listview](https://learn.microsoft.com/uwp/api/Windows.UI.Xaml.Controls.ListView), create a public AdvancedCollectionView and pass your list in the constructor to it. If you've done that you can use the many useful features it provides:
* sorting your list using the `SortDirection` helper: specify any number of property names to sort on with the direction desired
* filtering your list using a [Predicate](https://learn.microsoft.com/dotnet/core/api/system.predicate-1): this will automatically filter your list only to the items that pass the check by the predicate provided
@@ -24,58 +22,13 @@ In your viewmodel instead of having a public [IEnumerable](https://learn.microso
* incremental loading: if your source collection supports the feature then AdvancedCollectionView will do as well (it simply forwards the calls)
* live shaping: when constructing the `AdvancedCollectionView` you may specify that the collection use live shaping. This means that the collection will re-filter or re-sort if there are changes to the sort properties or filter properties that are specified using `ObserveFilterProperty`
-## Example
-
-```csharp
-using CommunityToolkit.WinUI.Collections;
-
-// Grab a sample type
-public class Person
-{
- public string Name { get; set; }
-}
+The `AdvancedCollectionView` is a good replacement for WPF's `CollectionViewSource`.
-// Set up the original list with a few sample items
-var oc = new ObservableCollection
-{
- new Person { Name = "Staff" },
- new Person { Name = "42" },
- new Person { Name = "Swan" },
- new Person { Name = "Orchid" },
- new Person { Name = "15" },
- new Person { Name = "Flame" },
- new Person { Name = "16" },
- new Person { Name = "Arrow" },
- new Person { Name = "Tempest" },
- new Person { Name = "23" },
- new Person { Name = "Pearl" },
- new Person { Name = "Hydra" },
- new Person { Name = "Lamp Post" },
- new Person { Name = "4" },
- new Person { Name = "Looking Glass" },
- new Person { Name = "8" },
-};
-
-// Set up the AdvancedCollectionView with live shaping enabled to filter and sort the original list
-var acv = new AdvancedCollectionView(oc, true);
-
-// Let's filter out the integers
-int nul;
-acv.Filter = x => !int.TryParse(((Person)x).Name, out nul);
-
-// And sort ascending by the property "Name"
-acv.SortDescriptions.Add(new SortDescription("Name", SortDirection.Ascending));
-
-// Let's add a Person to the observable collection
-var person = new Person { Name = "Aardvark" };
-oc.Add(person);
+## Example
-// Our added person is now at the top of the list, but if we rename this person, we can trigger a re-sort
-person.Name = "Zaphod"; // Now a re-sort is triggered and person will be last in the list
+The following is a complete example of how to perform ...
-// AdvancedCollectionView can be bound to anything that uses collections.
-YourListView.ItemsSource = acv;
-```
+> [!Sample AdvancedCollectionViewSample]
## Remarks
diff --git a/components/Collections/samples/AdvancedCollectionViewSample.xaml b/components/Collections/samples/AdvancedCollectionViewSample.xaml
index 80801029..58349990 100644
--- a/components/Collections/samples/AdvancedCollectionViewSample.xaml
+++ b/components/Collections/samples/AdvancedCollectionViewSample.xaml
@@ -1,9 +1,9 @@
-
+
@@ -17,8 +17,9 @@
-
-
+
+
+ ItemTemplate="{StaticResource EmployeeDataTemplate}"
+ ItemsSource="{x:Bind EmployeeCollection}" />
+ ItemTemplate="{StaticResource EmployeeDataTemplate}"
+ ItemsSource="{x:Bind CollectionView}" />
diff --git a/components/Collections/samples/AdvancedCollectionViewSample.xaml.cs b/components/Collections/samples/AdvancedCollectionViewSample.xaml.cs
index a7482a6d..8dfb75e6 100644
--- a/components/Collections/samples/AdvancedCollectionViewSample.xaml.cs
+++ b/components/Collections/samples/AdvancedCollectionViewSample.xaml.cs
@@ -3,13 +3,16 @@
// See the LICENSE file in the project root for more information.
using CommunityToolkit.WinUI.Collections;
+using System.Diagnostics.CodeAnalysis;
namespace CollectionsExperiment.Samples;
-[ToolkitSample(id: nameof(AdvancedCollectionViewSample), "AdvancedCollectionView", description: $"A sample for showing how to create and use a {nameof(AdvancedCollectionView)}.")]
+[ToolkitSample(id: nameof(AdvancedCollectionViewSample), "AdvancedCollectionView", description: $"A sample for showing how to create and use a {nameof(AdvancedCollectionView)} for sorting and filtering.")]
public sealed partial class AdvancedCollectionViewSample : Page
{
- public ObservableCollection? oc;
+ public ObservableCollection EmployeeCollection { get; private set; }
+
+ public AdvancedCollectionView CollectionView { get; private set; }
public AdvancedCollectionViewSample()
{
@@ -17,57 +20,56 @@ public AdvancedCollectionViewSample()
Setup();
}
+ [MemberNotNull(nameof(EmployeeCollection))]
+ [MemberNotNull(nameof(CollectionView))]
private void Setup()
{
// left list
- oc = new ObservableCollection
+ EmployeeCollection = new()
{
- new Person { Name = "Staff" },
- new Person { Name = "42" },
- new Person { Name = "Swan" },
- new Person { Name = "Orchid" },
- new Person { Name = "15" },
- new Person { Name = "Flame" },
- new Person { Name = "16" },
- new Person { Name = "Arrow" },
- new Person { Name = "Tempest" },
- new Person { Name = "23" },
- new Person { Name = "Pearl" },
- new Person { Name = "Hydra" },
- new Person { Name = "Lamp Post" },
- new Person { Name = "4" },
- new Person { Name = "Looking Glass" },
- new Person { Name = "8" },
+ new() { Name = "Staff" },
+ new() { Name = "42" },
+ new() { Name = "Swan" },
+ new() { Name = "Orchid" },
+ new() { Name = "15" },
+ new() { Name = "Flame" },
+ new() { Name = "16" },
+ new() { Name = "Arrow" },
+ new() { Name = "Tempest" },
+ new() { Name = "23" },
+ new() { Name = "Pearl" },
+ new() { Name = "Hydra" },
+ new() { Name = "Lamp Post" },
+ new() { Name = "4" },
+ new() { Name = "Looking Glass" },
+ new() { Name = "8" },
};
- LeftList.ItemsSource = oc;
-
// right list
- var acv = new AdvancedCollectionView(oc);
- int nul;
- acv.Filter = x => !int.TryParse(((Person)x).Name, out nul);
- acv.SortDescriptions.Add(new SortDescription("Name", SortDirection.Ascending));
+ AdvancedCollectionView acv = new(EmployeeCollection);
+ acv.Filter = x => !int.TryParse(((Employee)x).Name, out _);
+ acv.SortDescriptions.Add(new(nameof(Employee.Name), SortDirection.Ascending));
- RightList.ItemsSource = acv;
+ CollectionView = acv;
}
private void Add_Click(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrWhiteSpace(NewItemBox.Text))
{
- oc!.Insert(0, new Person { Name = NewItemBox.Text });
+ EmployeeCollection.Insert(0, new Employee { Name = NewItemBox.Text });
NewItemBox.Text = "";
}
}
+}
+///
+/// A sample class used to show how to use the class.
+///
+public partial class Employee
+{
///
- /// A sample class used to show how to use the interface.
+ /// Gets or sets the name of the person.
///
- public class Person
- {
- ///
- /// Gets or sets the name of the person.
- ///
- public string? Name { get; set; }
- }
+ public string? Name { get; set; }
}
diff --git a/components/Collections/samples/Collections.Samples.csproj b/components/Collections/samples/Collections.Samples.csproj
index 1aa967d9..3439c3f9 100644
--- a/components/Collections/samples/Collections.Samples.csproj
+++ b/components/Collections/samples/Collections.Samples.csproj
@@ -23,4 +23,10 @@
PreserveNewest
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/components/Collections/samples/IncrementalLoadingCollectionSample.xaml b/components/Collections/samples/IncrementalLoadingCollectionSample.xaml
index 2557ed51..19ab8f69 100644
--- a/components/Collections/samples/IncrementalLoadingCollectionSample.xaml
+++ b/components/Collections/samples/IncrementalLoadingCollectionSample.xaml
@@ -1,9 +1,9 @@
-
+
@@ -19,18 +19,18 @@
+ Text="{x:Bind PeopleSource.IsLoading, Mode=OneWay}" />
+ Text="{x:Bind PeopleSource.HasMoreItems, Mode=OneWay}" />
@@ -43,9 +43,10 @@
BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="4">
-
+
-
+
@@ -58,7 +59,7 @@
+ Text="{x:Bind Name}" />
diff --git a/components/Collections/samples/IncrementalLoadingCollectionSample.xaml.cs b/components/Collections/samples/IncrementalLoadingCollectionSample.xaml.cs
index 4b02acd3..74ea0b48 100644
--- a/components/Collections/samples/IncrementalLoadingCollectionSample.xaml.cs
+++ b/components/Collections/samples/IncrementalLoadingCollectionSample.xaml.cs
@@ -9,25 +9,12 @@ namespace CollectionsExperiment.Samples;
[ToolkitSample(id: nameof(IncrementalLoadingCollectionSample), "Incremental Loading Collection", description: $"A sample for showing how to create and use a IncrementalLoadingCollection.")]
public sealed partial class IncrementalLoadingCollectionSample : Page
{
+ // IncrementalLoadingCollection can be bound to a GridView or a ListView. In this case it is a ListView called PeopleListView.
+ public IncrementalLoadingCollection PeopleSource { get; set; } = new(new PeopleSource());
+
public IncrementalLoadingCollectionSample()
{
this.InitializeComponent();
- Load();
- }
- private void Load()
- {
- // IncrementalLoadingCollection can be bound to a GridView or a ListView. In this case it is a ListView called PeopleListView.
- var collection = new IncrementalLoadingCollection(new PeopleSource());
- PeopleListView.ItemsSource = collection;
-
- // Binds the collection to the page DataContext in order to use its IsLoading and HasMoreItems properties.
- DataContext = collection;
- }
-
- private async void RefreshCollection(object sender, RoutedEventArgs e)
- {
- var collection = (IncrementalLoadingCollection)PeopleListView.ItemsSource;
- await collection.RefreshAsync();
}
}
@@ -35,7 +22,7 @@ private async void RefreshCollection(object sender, RoutedEventArgs e)
/// A sample implementation of the interface.
///
///
-public class PeopleSource : IIncrementalSource
+public partial class PeopleSource : IIncrementalSource
{
private readonly List _people;
@@ -94,7 +81,7 @@ public PeopleSource()
///
/// A sample class used to show how to use the interface.
///
-public class Person
+public partial class Person
{
///
/// Gets or sets the name of the person.
diff --git a/components/Collections/src/CommunityToolkit.WinUI.Collections.csproj b/components/Collections/src/CommunityToolkit.WinUI.Collections.csproj
index 68138678..1e278d17 100644
--- a/components/Collections/src/CommunityToolkit.WinUI.Collections.csproj
+++ b/components/Collections/src/CommunityToolkit.WinUI.Collections.csproj
@@ -8,6 +8,7 @@
CommunityToolkit.WinUI.CollectionsRnsReadMe.md
+ true
diff --git a/components/ColorPicker/src/CommunityToolkit.WinUI.Controls.ColorPicker.csproj b/components/ColorPicker/src/CommunityToolkit.WinUI.Controls.ColorPicker.csproj
index 87f7d0e3..3c685394 100644
--- a/components/ColorPicker/src/CommunityToolkit.WinUI.Controls.ColorPicker.csproj
+++ b/components/ColorPicker/src/CommunityToolkit.WinUI.Controls.ColorPicker.csproj
@@ -6,6 +6,7 @@
CommunityToolkit.WinUI.Controls.ColorPickerRns
+ true
diff --git a/components/Helpers/src/CommunityToolkit.WinUI.Helpers.csproj b/components/Helpers/src/CommunityToolkit.WinUI.Helpers.csproj
index c586beef..2f692ab1 100644
--- a/components/Helpers/src/CommunityToolkit.WinUI.Helpers.csproj
+++ b/components/Helpers/src/CommunityToolkit.WinUI.Helpers.csproj
@@ -8,6 +8,7 @@
CommunityToolkit.WinUI.HelpersRnsReadMe.md
+ true
diff --git a/components/ImageCropper/src/Dependencies.props b/components/ImageCropper/src/Dependencies.props
index 92911a92..d46a2f3a 100644
--- a/components/ImageCropper/src/Dependencies.props
+++ b/components/ImageCropper/src/Dependencies.props
@@ -11,7 +11,7 @@
-
+
@@ -21,7 +21,7 @@
-
+
diff --git a/components/Media/src/CommunityToolkit.WinUI.Media.csproj b/components/Media/src/CommunityToolkit.WinUI.Media.csproj
index 21ff99fd..4a52a160 100644
--- a/components/Media/src/CommunityToolkit.WinUI.Media.csproj
+++ b/components/Media/src/CommunityToolkit.WinUI.Media.csproj
@@ -8,6 +8,7 @@
CommunityToolkit.WinUI.MediaRnsReadMe.md
+ true
diff --git a/components/Media/src/Dependencies.props b/components/Media/src/Dependencies.props
index da3896da..04c44f45 100644
--- a/components/Media/src/Dependencies.props
+++ b/components/Media/src/Dependencies.props
@@ -11,12 +11,12 @@
-
+
-
+
diff --git a/components/Primitives/src/CommunityToolkit.WinUI.Controls.Primitives.csproj b/components/Primitives/src/CommunityToolkit.WinUI.Controls.Primitives.csproj
index 18c64107..2dbc8983 100644
--- a/components/Primitives/src/CommunityToolkit.WinUI.Controls.Primitives.csproj
+++ b/components/Primitives/src/CommunityToolkit.WinUI.Controls.Primitives.csproj
@@ -8,6 +8,7 @@
CommunityToolkit.WinUI.Controls.PrimitivesRnsReadMe.md
+ true
diff --git a/components/RichSuggestBox/src/CommunityToolkit.WinUI.Controls.RichSuggestBox.csproj b/components/RichSuggestBox/src/CommunityToolkit.WinUI.Controls.RichSuggestBox.csproj
index f50bf0ff..b3e2f0d2 100644
--- a/components/RichSuggestBox/src/CommunityToolkit.WinUI.Controls.RichSuggestBox.csproj
+++ b/components/RichSuggestBox/src/CommunityToolkit.WinUI.Controls.RichSuggestBox.csproj
@@ -8,6 +8,7 @@
CommunityToolkit.WinUI.Controls.RichSuggestBoxRnsReadMe.md
+ true
diff --git a/components/SettingsControls/src/CommunityToolkit.WinUI.Controls.SettingsControls.csproj b/components/SettingsControls/src/CommunityToolkit.WinUI.Controls.SettingsControls.csproj
index 86b9a3a9..c605d7ca 100644
--- a/components/SettingsControls/src/CommunityToolkit.WinUI.Controls.SettingsControls.csproj
+++ b/components/SettingsControls/src/CommunityToolkit.WinUI.Controls.SettingsControls.csproj
@@ -8,6 +8,7 @@
CommunityToolkit.WinUI.Controls.SettingsControlsRnsReadMe.md
+ true
diff --git a/components/SettingsControls/src/SettingsExpander/SettingsExpander.Properties.cs b/components/SettingsControls/src/SettingsExpander/SettingsExpander.Properties.cs
index b209f16f..d3924795 100644
--- a/components/SettingsControls/src/SettingsExpander/SettingsExpander.Properties.cs
+++ b/components/SettingsControls/src/SettingsExpander/SettingsExpander.Properties.cs
@@ -45,7 +45,7 @@ public partial class SettingsExpander
new PropertyMetadata(defaultValue: null));
///
- /// The backing for the property.
+ /// The backing for the property.
///
public static readonly DependencyProperty ItemsHeaderProperty = DependencyProperty.Register(
nameof(ItemsHeader),
@@ -54,7 +54,7 @@ public partial class SettingsExpander
new PropertyMetadata(defaultValue: null));
///
- /// The backing for the property.
+ /// The backing for the property.
///
public static readonly DependencyProperty ItemsFooterProperty = DependencyProperty.Register(
nameof(ItemsFooter),
diff --git a/components/TokenizingTextBox/src/CommunityToolkit.WinUI.Controls.TokenizingTextBox.csproj b/components/TokenizingTextBox/src/CommunityToolkit.WinUI.Controls.TokenizingTextBox.csproj
index 572d6a05..bc73b6cb 100644
--- a/components/TokenizingTextBox/src/CommunityToolkit.WinUI.Controls.TokenizingTextBox.csproj
+++ b/components/TokenizingTextBox/src/CommunityToolkit.WinUI.Controls.TokenizingTextBox.csproj
@@ -8,6 +8,7 @@
CommunityToolkit.WinUI.Controls.TokenizingTextBoxRnsReadMe.md
+ true
diff --git a/components/Triggers/src/CompareStateTrigger.cs b/components/Triggers/src/CompareStateTrigger.cs
index a44aa6c1..c01c6f1d 100644
--- a/components/Triggers/src/CompareStateTrigger.cs
+++ b/components/Triggers/src/CompareStateTrigger.cs
@@ -13,7 +13,7 @@ namespace CommunityToolkit.WinUI;
///
/// Example: Trigger if a value is greater than 0
///
- /// <triggers:CompareStateTrigger Value="{Binding MyValue}" CompareTo="0" Comparison="GreaterThan" />
+ /// <triggers:CompareStateTrigger Value="{x:Bind MyValue, Mode=OneWay}" CompareTo="0" Comparison="GreaterThan" />
///
///
///
diff --git a/components/Triggers/src/IsEqualStateTrigger.cs b/components/Triggers/src/IsEqualStateTrigger.cs
index 2282acab..04b6bbd1 100644
--- a/components/Triggers/src/IsEqualStateTrigger.cs
+++ b/components/Triggers/src/IsEqualStateTrigger.cs
@@ -13,7 +13,7 @@ namespace CommunityToolkit.WinUI;
///
/// Example: Trigger if a value is null
///
-/// <triggers:EqualsStateTrigger Value="{Binding MyObject}" EqualTo="{x:Null}" />
+/// <triggers:EqualsStateTrigger Value="{x:Bind MyObject, Mode=OneWay}" EqualTo="{x:Null}" />
///
///
///
diff --git a/global.json b/global.json
index e4e1a5f4..91187a7c 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "8.0.201",
+ "version": "8.0.403",
"rollForward": "latestFeature"
},
"msbuild-sdks":
diff --git a/tooling b/tooling
index 9375f96f..d71b08b2 160000
--- a/tooling
+++ b/tooling
@@ -1 +1 @@
-Subproject commit 9375f96fafe362e1a549ecd157cbc3f7ba20ecaf
+Subproject commit d71b08b2dccf94c3ceaeda99526679bc0cfc3b8a