diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 727dffdf..2817fea9 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "uno.check": { - "version": "1.14.1", + "version": "1.20.2", "commands": [ "uno-check" ] @@ -15,7 +15,7 @@ ] }, "microsoft.visualstudio.slngen.tool": { - "version": "9.5.4", + "version": "11.2.3", "commands": [ "slngen" ] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6ef0a7e9..e50fee03 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,7 +7,7 @@ "args": { // Update 'VARIANT' to pick a .NET Core version: 3.1, 5.0, 6.0 // Append -bullseye or -focal to pin to an OS version. - "VARIANT": "7.0", + "VARIANT": "8.0", // Options "NODE_VERSION": "lts/*" } diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 00000000..c85ffbf6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,146 @@ +name: Bug report +description: Create a report to help us fix something within the Windows Community Toolkit. +labels: ["bug :bug:"] +body: +- type: markdown + attributes: + value: | + ## Before you begin + 🚨 **Please do not skip instructions**🚨 + + This info is essential for investigating your bug report. Issues with missing information may be closed without investigation. + + If you're uncertain about a problem, find or start a [Questions & Answers](https://github.com/CommunityToolkit/Windows/discussions/categories/q-a) discussion, where you can get insight from the community regarding your issue. +- type: textarea + id: description + validations: + required: true + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. +- type: textarea + id: repro-steps + validations: + required: true + attributes: + label: Steps to reproduce + render: text + description: Provide steps to reproduce the issue, or let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...) + placeholder: | + The easier we can reproduce the issue, the easier it is to understand and fix the problem. + Provide repro steps, code-snippets, or a standalone project to help us understand the issue you're facing. + + If the problem can be reproduced in our [Sample Gallery](https://aka.ms/windowstoolkitapp), you can speed up creation of a functional repro by forking the toolkit and adding or modifying a test or sample. Link to the forked repo and branch. + + Example repro steps: + 1. Given the following environment (Sample App w/ XAML, Project with Isolated setup, etc...) + 2. Go to '...' + 3. Click on '....' + 4. Scroll down to '....' + 5. See error +- type: textarea + id: expected-behavior + validations: + required: true + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. +- type: textarea + id: screenshots + attributes: + label: Screenshots + description: If applicable, add screenshots to help explain your problem. +- type: checkboxes + id: platform + attributes: + label: Code Platform + description: Check the platforms where you see the issue occur. + options: + - label: UWP + - label: WinAppSDK / WinUI 3 + - label: Web Assembly (WASM) + - label: Android + - label: iOS + - label: MacOS + - label: Linux / GTK +- type: checkboxes + id: environment-windows-build + attributes: + label: Windows Build Number + description: Check one or more of the following options (if applicable) + options: + - label: Windows 10 1809 (Build 17763) + - label: Windows 10 1903 (Build 18362) + - label: Windows 10 1909 (Build 18363) + - label: Windows 10 2004 (Build 19041) + - label: Windows 10 20H2 (Build 19042) + - label: Windows 10 21H1 (Build 19043) + - label: Windows 10 21H2 (Build 19044) + - label: Windows 10 22H2 (Build 19045) + - label: Windows 11 21H2 (Build 22000) + - label: Other (specify) +- type: input + id: environment-windows-build-other-build-number + attributes: + label: Other Windows Build number + description: If applicable, another Windows build number not listed (such as an Insider build) +- type: checkboxes + id: environment-app-min-target-version + attributes: + label: App minimum and target SDK version + description: Check one or more of the following options + options: + - label: Windows 10, version 1809 (Build 17763) + - label: Windows 10, version 1903 (Build 18362) + - label: Windows 10, version 1909 (Build 18363) + - label: Windows 10, version 2004 (Build 19041) + - label: Windows 10, version 2104 (Build 20348) + - label: Windows 11, version 22H2 (Build 22000) + - label: Other (specify) +- type: input + id: environment-app-min-target-other-build-number + attributes: + label: Other SDK version + description: If applicable, another SDK version not listed (such as an Insider SDK) +- type: dropdown + id: visual-studio-version + attributes: + multiple: true + label: Visual Studio Version + description: Check one or more of the following options + options: + - 2022 + - Preview +- type: input + id: visual-studio-exact-build + attributes: + label: Visual Studio Build Number + description: What's the exact build number? (Found in Visual Studio under Help -> About Microsoft Visual Studio) +- type: dropdown + id: form-factor + attributes: + multiple: true + label: Device form factor + description: Check one or more of the following options + options: + - Desktop + - Xbox + - Surface Hub + - IoT + - Mobile +- type: textarea + id: additional-context + attributes: + label: Additional context + description: Add any other context about the problem here. +- type: dropdown + id: contribution + validations: + required: true + attributes: + label: Help us help you + description: Would you like to contribute a solution to this issue? + options: + - Yes, I'd like to be assigned to work on this item. + - Yes, but only if others can assist. + - No, I'm unable to contribute a solution. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..3d4c0a45 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,23 @@ +blank_issues_enabled: false +contact_links: + - name: Questions about the Toolkit? + url: https://github.com/CommunityToolkit/Windows/discussions/categories/q-a + about: I have a question about how to use something in the toolkit. + - name: New Idea? + url: https://github.com/CommunityToolkit/Labs-Windows/discussions?discussions_q=category%3AExperiments+category%3AIdeas+category%3AProposals + about: Labs is where we propose and experiment with new ideas. Search ongoing experiments or contribute your own! + - name: MVVM Toolkit, High Performance, or Diagnostic Package + url: https://aka.ms/toolkit/dotnet + about: "If you have a question on these, see the .NET Community Toolkit repo:" + - name: MAUI Community Toolkit + url: https://aka.ms/toolkit/maui + about: "This repository is for the Windows Community Toolkit. For MAUI, see the MAUI Community Toolkit repo:" + - name: WindowsAppSDK + url: https://aka.ms/windowsappsdk + about: "This repository is for the Windows Community Toolkit, for issues in the platform itself, see the WindowsAppSDK repo:" + - name: Cross-platform / Uno Platform + url: https://github.com/unoplatform/uno + 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." diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..c4425ea6 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,61 @@ + + + + + + + + +## Fixes + + + + + + + +## PR Type + +What kind of change does this PR introduce? + + + + + + + + + + + + +## What is the current behavior? + + + +## What is the new behavior? + + + +## PR Checklist + +Please check if your PR fulfills the following requirements: + +- [ ] Created a feature/dev branch in your fork (vs. submitting directly from a commit on main) +- [ ] Based off latest main branch of toolkit +- [ ] Tested code with current supported SDKs +- [ ] New component + - [ ] Documentation has been added + - [ ] Sample in sample app has been added + - [ ] Analyzers are passing for documentation and samples + - [ ] Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/CommunityToolkit/WindowsCommunityToolkit-design-assets) +- [ ] Tests for the changes have been added (if applicable) +- [ ] Header has been added to all new source files +- [ ] Contains **NO** breaking changes + + + +## Other information + + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d28b9b2..46aa6698 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ on: merge_group: env: - DOTNET_VERSION: ${{ '7.0.100' }} + DOTNET_VERSION: ${{ '8.0.201' }} ENABLE_DIAGNOSTICS: true MSBUILD_VERBOSITY: normal #COREHOST_TRACE: 1 @@ -67,7 +67,7 @@ jobs: env: # faux-ternary expression to select which platforms to build for each platform vs. duplicating step below. - TARGET_PLATFORMS: all + TARGET_PLATFORMS: ${{ matrix.platform != 'WinUI3' && 'all-wasdk' || 'all-uwp' }} TEST_PLATFORM: ${{ matrix.platform != 'WinUI3' && 'UWP' || 'WinAppSdk' }} VERSION_PROPERTY: ${{ github.ref == 'refs/heads/main' && format('build.{0}', github.run_number) || format('pull-{0}.{1}', github.event.number, github.run_number) }} @@ -108,7 +108,6 @@ jobs: - name: Restore dotnet tools run: dotnet tool restore - # Pinning Manifest for 1.13 version of Uno.Check at the moment to unblock build, see https://github.com/CommunityToolkit/Windows/pull/201 - name: Run Uno Check to Install Dependencies run: > dotnet tool run uno-check @@ -119,10 +118,11 @@ jobs: --skip androidemulator --skip vswinworkloads --verbose - --manifest https://raw.githubusercontent.com/unoplatform/uno.check/c3b289d7bb16a2a2df7f7f7f848d76fe1e74036d/manifests/uno.ui.manifest.json - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.3.1 + uses: microsoft/setup-msbuild@v2 + with: + vs-version: '[17.9,)' - name: Enable ${{ env.TARGET_PLATFORMS }} TargetFrameworks working-directory: ./${{ env.MULTI_TARGET_DIRECTORY }} @@ -175,7 +175,7 @@ jobs: # Build All Packages - name: pack experiments working-directory: ./tooling/Scripts/ - run: ./PackEachExperiment.ps1 -date ${{ env.VERSION_DATE }} -postfix ${{ env.VERSION_PROPERTY }} + run: ./PackEachExperiment.ps1 -date ${{ env.VERSION_DATE }}${{ env.VERSION_PROPERTY != '' && format(' -postfix {0}', env.VERSION_PROPERTY) || '' }} # Push Pull Request Packages to our DevOps Artifacts Feed (see nuget.config) - name: Push Pull Request Packages (if not fork) diff --git a/Directory.Build.props b/Directory.Build.props index 044fb8d9..d0e8f102 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,23 +1,23 @@ 8 - 0 - preview + 1 CommunityToolkit $([MSBuild]::EnsureTrailingSlash('$(MSBuildThisFileDirectory)')) $(RepositoryDirectory)tooling true $(RepositoryDirectory)components\Converters\src\CommunityToolkit.WinUI.Converters.csproj - $(RepositoryDirectory)components\Extensions\src\CommunityToolkit.WinUI.Extensions.csproj + $(RepositoryDirectory)components\Extensions\src\CommunityToolkit.WinUI.Extensions.csproj $(RepositoryDirectory)components\Triggers\src\CommunityToolkit.WinUI.Triggers.csproj $(RepositoryDirectory)components\SettingsControls\src\CommunityToolkit.WinUI.Controls.SettingsControls.csproj - $(RepositoryDirectory)components\Helpers\src\CommunityToolkit.WinUI.Helpers.csproj - $(RepositoryDirectory)components\Behaviors\src\CommunityToolkit.WinUI.Behaviors.csproj - $(RepositoryDirectory)components\Animations\src\CommunityToolkit.WinUI.Animations.csproj - $(RepositoryDirectory)components\Primitives\src\CommunityToolkit.WinUI.Controls.Primitives.csproj + $(RepositoryDirectory)components\Helpers\src\CommunityToolkit.WinUI.Helpers.csproj + $(RepositoryDirectory)components\Behaviors\src\CommunityToolkit.WinUI.Behaviors.csproj + $(RepositoryDirectory)components\Animations\src\CommunityToolkit.WinUI.Animations.csproj + $(RepositoryDirectory)components\Primitives\src\CommunityToolkit.WinUI.Controls.Primitives.csproj + $(RepositoryDirectory)components\Sizers\src\CommunityToolkit.WinUI.Controls.Sizers.csproj diff --git a/ReadMe.md b/ReadMe.md index b686c530..be916f68 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -5,15 +5,23 @@ Welcome to the home of Windows Community Toolkit. Our components are built on top of [WinUI 2](https://aka.ms/winuigithub), [WinUI 3](https://aka.ms/winui3), and [Uno Platform](https://platform.uno)! -**Find out more and provide feedback in the [2023 Windows Community Toolkit Feedback Thread](https://github.com/CommunityToolkit/Windows/discussions/31).** +They enable developers to build great experiences for Windows with .NET! + +_Building something cool? Want to engage with other developers? Want to contribute to the Toolkit? **[Engage in the discussion here!](https://github.com/CommunityToolkit/Windows/discussions)**_ ## Getting Started -### [Try out our Sample App live in your browser!](https://toolkitlabs.dev) +### [Try out our Sample Gallery from the Microsoft Store](https://aka.ms/windowstoolkitapp) + +Want to see the toolkit in action before jumping into the code? Download and play with the [Windows Community Toolkit Gallery](https://www.microsoft.com/store/apps/9nblggh4tlcq) from the Store. + +Please read the [Getting Started with the Windows Community Toolkit](https://docs.microsoft.com/dotnet/communitytoolkit/windows/getting-started) page for more detailed information about using the toolkit. + +### Windows Community Toolkit Labs -Want to see the toolkit in action before jumping into the code? Download and play with the [Windows Community Toolkit Sample App](https://www.microsoft.com/store/apps/9nblggh4tlcq) from the Store. +Have an idea for a new feature? Want to checkout the latest things being built. _[Then head over to Windows Community Toolkit Labs](https://aka.ms/toolkit/labs/windows)_. -Please read the [Getting Started with the Windows Community Toolkit](https://docs.microsoft.com/windows/communitytoolkit/getting-started) page for more detailed information about using the toolkit. +You can even see the latest components [live in your browser!](https://toolkitlabs.dev) ## Clone the repository @@ -32,17 +40,24 @@ git clone --recurse-submodules https://github.com/CommunityToolkit/Windows.git ## 🚀 Contribution -Find out the latest info in out [discussion thread here](https://github.com/CommunityToolkit/Windows/discussions/31) +We're always looking for a helping hand, [look for issues that we need help with here](https://github.com/CommunityToolkit/Windows/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) or head over to [Windows Community Toolkit Labs](https://aka.ms/toolkit/labs/windows) to try or build new features. -Do you want to contribute? Check out our [Windows Community Toolkit Wiki](https://aka.ms/wct/wiki) page to learn more about contribution and guidelines in general. +Even just improving our docs and samples for existing components here, or adding new tests can be a huge help! + +Check out our [Windows Community Toolkit Wiki](https://aka.ms/wct/wiki) page to learn more about contribution and guidelines in general (to be updated more soon). ## 📦 NuGet Packages -NuGet is a standard package manager for .NET applications which is built into Visual Studio. When you open solution in Visual Studio, choose the *Tools* menu > *NuGet Package Manager* > *Manage NuGet packages for solution…* Enter one of the package names mentioned in [Windows Community Toolkit NuGet Packages](https://docs.microsoft.com/windows/communitytoolkit/nuget-packages) table to search for it online. +NuGet is a standard package manager for .NET applications which is built into Visual Studio. When you open solution in Visual Studio, choose the *Tools* menu > *NuGet Package Manager* > *Manage NuGet packages for solution…* + +There are now two sets of packages for each component: + +- `CommunityToolkit.Uwp.*` for UWP + WinUI 2 or Uno.UI +- `CommunityToolkit.WinUI.*` for Windows App SDK + WinUI 3 or Uno.WinUI ## 📫 Features -The [Features list](https://github.com/MicrosoftDocs/WindowsCommunityToolkitDocs/blob/master/docs/toc.md#controls) refers to all the currently available features that can be found in the Windows Community Toolkit. Most features should work with the October 2018 Update (1809) SDK 17763 and above; however, refer to specific documentation on each feature for more information. +Most features should work with the October 2018 Update (1809) SDK 17763 and above; however, refer to specific documentation on each feature for more information. ## 💠 Principles diff --git a/components/Animations/samples/Animations.Samples.csproj b/components/Animations/samples/Animations.Samples.csproj index 549f237c..89fb0d68 100644 --- a/components/Animations/samples/Animations.Samples.csproj +++ b/components/Animations/samples/Animations.Samples.csproj @@ -1,10 +1,17 @@ - + + + Animations + + + + + diff --git a/components/Animations/samples/Animations.md b/components/Animations/samples/Animations.md index a66f6add..968408ff 100644 --- a/components/Animations/samples/Animations.md +++ b/components/Animations/samples/Animations.md @@ -6,15 +6,15 @@ keywords: Animations, Effects, Layout, Composition, animationset dev_langs: - csharp category: Animations -subcategory: Layout +subcategory: Effects discussion-id: 0 issue-id: 0 icon: Assets/ImplicitAnimations.png --- -The [`ImplicitAnimationSet`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.ImplicitAnimationSet) type is the equivalent of [`AnimationSet`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.AnimationSet) in the context of implicit [Composition animations](/windows/uwp/composition/composition-animation). It represents a set of implicit animations that can only run on the [Composition layer](/windows/uwp/composition/visual-layer) and that are available in three categories: show, hide, and implicit animations. `ImplicitAnimationSet` restricts the type of contained animations to objects implementing the [`IImplicitTimeline`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.IImplicitTimeline) interface to offer an additional level of build-time safety when constructing animations from XAML. Similar to the other interfaces used for explicit animations this architecture is also extensible in that users can also easily plug in their custom types implementing this interface into an `ImplicitAnimationSet` collection. +The `ImplicitAnimationSet` type is the equivalent of `AnimationSet` in the context of implicit [Composition animations](https://learn.microsoft.com/windows/uwp/composition/composition-animation). It represents a set of implicit animations that can only run on the [Composition layer](https://learn.microsoft.com/windows/uwp/composition/visual-layer) and that are available in three categories: show, hide, and implicit animations. `ImplicitAnimationSet` restricts the type of contained animations to objects implementing the `IImplicitTimeline` interface to offer an additional level of build-time safety when constructing animations from XAML. Similar to the other interfaces used for explicit animations this architecture is also extensible in that users can also easily plug in their custom types implementing this interface into an `ImplicitAnimationSet` collection. -> **Platform APIs:** [`ImplicitAnimationSet`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.ImplicitAnimationSet), [`AnimationSet`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.AnimationSet), [`IImplicitTimeline`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.IImplicitTimeline), [`Implicit`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.Implicit) +> **Platform APIs:** `ImplicitAnimationSet`, `AnimationSet`, `IImplicitTimeline`, `Implicit` ## How it works diff --git a/components/Animations/samples/ConnectedAnimations.md b/components/Animations/samples/ConnectedAnimations.md index 47b015aa..7f8b6d20 100644 --- a/components/Animations/samples/ConnectedAnimations.md +++ b/components/Animations/samples/ConnectedAnimations.md @@ -6,16 +6,13 @@ keywords: Animations, Effects, Layout, Composition, animationset, animation, coo dev_langs: - csharp category: Animations -subcategory: Layout +subcategory: Effects discussion-id: 0 issue-id: 0 icon: Assets/ConnectedAnimations.png --- - -# Connected Animations XAML Attached Properties - -[Connected animations](/windows/uwp/style/connected-animation) let you create a dynamic and compelling navigation experience by animating the transition of an element between two different views. +[Connected animations](https://learn.microsoft.com/windows/uwp/style/connected-animation) let you create a dynamic and compelling navigation experience by animating the transition of an element between two different views. The Connected Animations XAML Attached Properties enable connected animations to be defined directly in your XAML code by simply adding a Key to the element that should animate. There are also attached properties to enable coordinated animations and animations in lists and grids. @@ -27,7 +24,7 @@ The Connected Animations XAML Attached Properties enable connected animations to - + @@ -35,7 +32,7 @@ The Connected Animations XAML Attached Properties enable connected animations to animations:Connected.ListItemKey="listItem"> - + @@ -46,11 +43,11 @@ The Connected Animations XAML Attached Properties enable connected animations to ### Connected.Key -Registers element with the [ConnectedAnimationsService](/uwp/api/Windows.UI.Xaml.Media.Animation.ConnectedAnimation). For the animation to work, the same key must be registered on two different pages when navigating +Registers element with the [ConnectedAnimationsService](https://learn.microsoft.com/uwp/api/Windows.UI.Xaml.Media.Animation.ConnectedAnimation). For the animation to work, the same key must be registered on two different pages when navigating ### Connected.AnchorElement -To enable [coordinated animations](/windows/uwp/style/connected-animation#coordinated-animation), use the AnchorElement attached property on the element that should appear alongside the connected animation element by specifying the connected animation element +To enable [coordinated animations](https://learn.microsoft.com/windows/uwp/style/connected-animation#coordinated-animation), use the AnchorElement attached property on the element that should appear alongside the connected animation element by specifying the connected animation element ### Connected.ListItemKey @@ -92,32 +89,21 @@ Unregisters an element (part of a DataTemplate in a list control) from the Conne The helper uses the page navigation parameter to decide which list item will be animated during the page navigation. However, in some cases the parameter passed during page navigation is not part of the list. For example, you might be only passing the id of an item as a navigation parameter and not the item itself. -In those cases, you can use the **SetListDataItemForNextConnectedAnnimation** extension method before page navigation to specify which item should be animated. +In those cases, you can use the **SetListDataItemForNextConnectedAnimation** extension method before page navigation to specify which item should be animated. ```csharp // dataItemToAnimate is an object in the ListViewBase.ItemsSource collection - Frame.SetListDataItemForNextConnectedAnnimation(dataItemToAnimate); + Frame.SetListDataItemForNextConnectedAnimation(dataItemToAnimate); Frame.Navigate(typeof(DetailsPage), dataItemToAnimate.Id); ``` -```vb - ' dataItemToAnimate is an object in the ListViewBase.ItemsSource collection - Frame.SetListDataItemForNextConnectedAnnimation(dataItemToAnimate) - Frame.Navigate(GetType(DetailsPage), dataItemToAnimate.Id) -``` - This method is also helpful when navigating back to an item different from the item it was navigated from. ```csharp - Frame.SetListDataItemForNextConnectedAnnimation(dataItemToAnimate); + Frame.SetListDataItemForNextConnectedAnimation(dataItemToAnimate); Frame.GoBack(); ``` -```vb - Frame.SetListDataItemForNextConnectedAnnimation(dataItemToAnimate) - Frame.GoBack() -``` - ## Examples We can create the above connected animations. @@ -128,8 +114,7 @@ We need a set a key for the element to be connected with another element in a di ```xaml - ``` @@ -140,14 +125,13 @@ We need to set the same key for the element to be connected with. Also, You can ```xaml - - - Header - Lorem ipsum ... + + ``` @@ -162,8 +146,8 @@ animations:Connected.ListItemKey="listItem"> - - + + @@ -179,16 +163,14 @@ In this page, you just need to give the same key. - - Lorem ipsum ... + + - Lorem Ipsum ... + ``` - diff --git a/components/Animations/samples/ConnectedAnimationsSample.xaml b/components/Animations/samples/ConnectedAnimationsSample.xaml index 6d2bf0a2..05e861ee 100644 --- a/components/Animations/samples/ConnectedAnimationsSample.xaml +++ b/components/Animations/samples/ConnectedAnimationsSample.xaml @@ -6,7 +6,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:AnimationsExperiment.Samples" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:ui="CommunityToolkit.WinUI" + xmlns:ui="using:CommunityToolkit.WinUI" mc:Ignorable="d"> + Content="{ui:FontIcon Glyph=, + FontSize=14}" + Visibility="Collapsed" /> + + + Animations This package contains Animations. @@ -6,6 +8,7 @@ CommunityToolkit.WinUI.AnimationsRns true + ReadMe.md @@ -19,7 +22,14 @@ - + + + + + + True + \ + diff --git a/components/Animations/src/Expressions/ExpressionFunctions.cs b/components/Animations/src/Expressions/ExpressionFunctions.cs index fb940af1..b0b48182 100644 --- a/components/Animations/src/Expressions/ExpressionFunctions.cs +++ b/components/Animations/src/Expressions/ExpressionFunctions.cs @@ -1283,8 +1283,8 @@ public ExpressionNodeInfo(OperationType nodeOperationKind, string operationStrin { ExpressionNodeType.ColorHsl, new ExpressionNodeInfo(OperationType.Function, "colorhsl") }, { ExpressionNodeType.ColorRgb, new ExpressionNodeInfo(OperationType.Function, "colorrgb") }, { ExpressionNodeType.ColorLerp, new ExpressionNodeInfo(OperationType.Function, "colorlerp") }, - { ExpressionNodeType.ColorLerpHsl, new ExpressionNodeInfo(OperationType.Function, "colorhsllerp") }, - { ExpressionNodeType.ColorLerpRgb, new ExpressionNodeInfo(OperationType.Function, "colorrgblerp") }, + { ExpressionNodeType.ColorLerpHsl, new ExpressionNodeInfo(OperationType.Function, "colorlerphsl") }, + { ExpressionNodeType.ColorLerpRgb, new ExpressionNodeInfo(OperationType.Function, "colorlerprgb") }, { ExpressionNodeType.Concatenate, new ExpressionNodeInfo(OperationType.Function, "concatenate") }, { ExpressionNodeType.Distance, new ExpressionNodeInfo(OperationType.Function, "distance") }, { ExpressionNodeType.DistanceSquared, new ExpressionNodeInfo(OperationType.Function, "distancesquared") }, diff --git a/components/Animations/src/Implicit.cs b/components/Animations/src/Implicit.cs index 692daabb..8e4fc90d 100644 --- a/components/Animations/src/Implicit.cs +++ b/components/Animations/src/Implicit.cs @@ -129,6 +129,12 @@ public static void SetAnimations(UIElement element, ImplicitAnimationSet value) /// The instance for the current event. private static void OnShowAnimationsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + // See https://github.com/CommunityToolkit/Windows/issues/319 + #if HAS_UNO + #pragma warning disable CS0162 + return; + #endif + static void OnAnimationsChanged(object sender, EventArgs e) { var collection = (ImplicitAnimationSet)sender; @@ -160,6 +166,10 @@ static void OnAnimationsChanged(object sender, EventArgs e) ElementCompositionPreview.SetImplicitShowAnimation(element, null); } } + + #if HAS_UNO + #pragma warning restore CS0162 + #endif } /// @@ -169,6 +179,12 @@ static void OnAnimationsChanged(object sender, EventArgs e) /// The instance for the current event. private static void OnHideAnimationsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + // See https://github.com/CommunityToolkit/Windows/issues/319 + #if HAS_UNO + #pragma warning disable CS0162 + return; + #endif + static void OnAnimationsChanged(object sender, EventArgs e) { var collection = (ImplicitAnimationSet)sender; @@ -200,6 +216,10 @@ static void OnAnimationsChanged(object sender, EventArgs e) ElementCompositionPreview.SetImplicitHideAnimation(element, null); } } + + #if HAS_UNO + #pragma warning restore CS0162 + #endif } /// @@ -209,6 +229,12 @@ static void OnAnimationsChanged(object sender, EventArgs e) /// The instance for the current event. private static void OnAnimationsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { + // See https://github.com/CommunityToolkit/Windows/issues/319 + #if HAS_UNO + #pragma warning disable CS0162 + return; + #endif + static void OnAnimationsChanged(object sender, EventArgs e) { var collection = (ImplicitAnimationSet)sender; @@ -240,5 +266,9 @@ static void OnAnimationsChanged(object sender, EventArgs e) ElementCompositionPreview.GetElementVisual(element).ImplicitAnimations = null; } } + + #if HAS_UNO + #pragma warning restore CS0162 + #endif } } diff --git a/components/Animations/src/ReadMe.md b/components/Animations/src/ReadMe.md new file mode 100644 index 00000000..9d9c6e56 --- /dev/null +++ b/components/Animations/src/ReadMe.md @@ -0,0 +1,31 @@ + +# Windows Community Toolkit - Animations + +This package is part of the [Windows Community Toolkit](https://aka.ms/toolkit/windows) from the [.NET Foundation](https://dotnetfoundation.org). + +## Package Contents + +This package contains the following in the `CommunityToolkit.WinUI.Animations` namespace: + +- AnimationBuilder +- AnimationSet +- Connected Animations Helpers +- Expressions +- Implicit Animations +- ScrollViewerExtensions + +## Which Package is for me? + +If you're developing with _UWP/WinUI 2 or Uno.UI_ you should be using the `CommunityToolkit.Uwp.Animations` package. + +If you're developing with _WindowsAppSDK/WinUI 3 or Uno.WinUI_ you should be using the `CommunityToolkit.WinUI.Animations` package. + +## Documentation + +Further documentation about these components can be found at: https://aka.ms/windowstoolkitdocs + +## License + +MIT + +See License.md in package for more details. diff --git a/components/Animations/tests/Animations.Tests.projitems b/components/Animations/tests/Animations.Tests.projitems index 32acc124..1fb5e1f4 100644 --- a/components/Animations/tests/Animations.Tests.projitems +++ b/components/Animations/tests/Animations.Tests.projitems @@ -10,5 +10,6 @@ + \ No newline at end of file diff --git a/components/Animations/tests/Test_AnimationBuilderStart.cs b/components/Animations/tests/Test_AnimationBuilderStart.cs index a25dfa6e..7cea9d73 100644 --- a/components/Animations/tests/Test_AnimationBuilderStart.cs +++ b/components/Animations/tests/Test_AnimationBuilderStart.cs @@ -9,7 +9,7 @@ namespace AnimationsExperiment.Tests; [TestClass] -[TestCategory("Test_AnimationBuilderStart")] +[TestCategory(nameof(Test_AnimationBuilderStart))] public class Test_AnimationBuilderStart : VisualUITestBase { [TestMethod] diff --git a/components/Animations/tests/Test_ExpressionFunctions.cs b/components/Animations/tests/Test_ExpressionFunctions.cs new file mode 100644 index 00000000..d2856b34 --- /dev/null +++ b/components/Animations/tests/Test_ExpressionFunctions.cs @@ -0,0 +1,59 @@ +// 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. + +#if WINUI2 +using Windows.UI.Composition; +using Windows.UI.Xaml.Hosting; +#elif WINUI3 +using Microsoft.UI.Composition; +using Microsoft.UI.Xaml.Hosting; +#endif + +using System.Numerics; +using CommunityToolkit.Tests; +using CommunityToolkit.Tooling.TestGen; +using CommunityToolkit.WinUI.Animations.Expressions; + +namespace AnimationsExperiment.Tests; + +[TestClass] +[TestCategory(nameof(Test_ExpressionFunctions))] +public partial class Test_ExpressionFunctions : VisualUITestBase +{ + [UIThreadTestMethod] + public void ColorLerpRgb(Grid rootGrid) + { + // See https://github.com/CommunityToolkit/Windows/issues/303 + var compositor = ElementCompositionPreview.GetElementVisual(rootGrid).Compositor; + var brush = compositor.CreateColorBrush(); + var temp = ExpressionFunctions.ColorRgb(255f, 255f, 0f, 0f); + var color = ExpressionFunctions.ColorLerpRgb(temp, temp, 0.5f); + + brush.StartAnimation("Color", color); + + var visual = compositor.CreateSpriteVisual(); + visual.Brush = brush; + visual.RelativeSizeAdjustment = Vector2.One; + + ElementCompositionPreview.SetElementChildVisual(rootGrid, visual); + } + + [UIThreadTestMethod] + public void ColorLerpHsl(Grid rootGrid) + { + // See https://github.com/CommunityToolkit/Windows/issues/303 + var compositor = ElementCompositionPreview.GetElementVisual(rootGrid).Compositor; + var brush = compositor.CreateColorBrush(); + var temp = ExpressionFunctions.ColorHsl(255f, 255f, 0f); + var color = ExpressionFunctions.ColorLerpHsl(temp, temp, 0.5f); + + brush.StartAnimation("Color", color); + + var visual = compositor.CreateSpriteVisual(); + visual.Brush = brush; + visual.RelativeSizeAdjustment = Vector2.One; + + ElementCompositionPreview.SetElementChildVisual(rootGrid, visual); + } +} diff --git a/components/Behaviors/samples/Assets/AnimationSet.png b/components/Behaviors/samples/Assets/AnimationSet.png index 4e8f924f..d12f585d 100644 Binary files a/components/Behaviors/samples/Assets/AnimationSet.png and b/components/Behaviors/samples/Assets/AnimationSet.png differ diff --git a/components/Behaviors/samples/Behaviors.Animations.md b/components/Behaviors/samples/Behaviors.Animations.md index 67c2d8a1..6b91520e 100644 --- a/components/Behaviors/samples/Behaviors.Animations.md +++ b/components/Behaviors/samples/Behaviors.Animations.md @@ -5,16 +5,16 @@ description: A collection of animations that can be grouped together. keywords: Behaviors, animations, animationset, xaml, visual, composition dev_langs: - csharp -category: Xaml -subcategory: Behaviors +category: Animations +subcategory: Miscellaneous discussion-id: 0 issue-id: 0 icon: Assets/AnimationSet.png --- -The [`AnimationSet`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.AnimationSet) type represents an animation schedule, effectively representing an [AnimationBuilder](/dotnet/api/microsoft.toolkit.uwp.ui.animations.AnimationBuilder) instance via XAML code. It can contain any number of animations or activities, exposes methods to start and stop an animation, and events to be notified when an animation has started or is completed. Like `AnimationBuilder`, `AnimationSet` instances can also be shared (e.g. in a [`ResourceDictionary`](/windows/uwp/design/controls-and-patterns/resourcedictionary-and-xaml-resource-references)) and then be used to start animation schedules on multiple UI elements. It can also be directly attached to a parent UI element, via the [`Explicit.Animations`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.Explicit) attached property. +The `AnimationSet` type represents an animation schedule, effectively representing an `AnimationBuilder` instance via XAML code. It can contain any number of animations or activities, exposes methods to start and stop an animation, and events to be notified when an animation has started or is completed. Like `AnimationBuilder`, `AnimationSet` instances can also be shared (e.g. in a [`ResourceDictionary`](https://learn.microsoft.com/windows/uwp/design/controls-and-patterns/resourcedictionary-and-xaml-resource-references)) and then be used to start animation schedules on multiple UI elements. It can also be directly attached to a parent UI element, via the `Explicit.Animations` attached property. -> **Platform APIs:** [`AnimationSet`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.AnimationSet), [AnimationBuilder](/dotnet/api/microsoft.toolkit.uwp.ui.animations.AnimationBuilder), [`Explicit`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.Explicit), [`ITimeline`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.ITimeline), [`IActivity`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.IActivity), [`AnimationScope`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.AnimationScope), [`AnimationStartedTriggerBehavior`](/dotnet/api/microsoft.toolkit.uwp.ui.behaviors.AnimationStartedTriggerBehavior), [`AnimationCompletedTriggerBehavior`](/dotnet/api/microsoft.toolkit.uwp.ui.behaviors.AnimationCompletedTriggerBehavior), [`StartAnimationAction`](/dotnet/api/microsoft.toolkit.uwp.ui.behaviors.StartAnimationAction), [`StopAnimationAction`](/dotnet/api/microsoft.toolkit.uwp.ui.behaviors.StopAnimationAction) +> **Platform APIs:** `AnimationSet`, `AnimationBuilder`, `Explicit`, `ITimeline`, `IActivity`, `AnimationScope`, `AnimationStartedTriggerBehavior`, `AnimationCompletedTriggerBehavior`, `StartAnimationAction`, `StopAnimationAction` ## How it works @@ -23,9 +23,9 @@ Each set can contain any number of animation scopes and individual nodes, which - **Animation types** are a mapping in XAML for the various APIs exposed by the `AnimationBuilder` class. They are available as both "default" animations that are ready to use and "custom" animations that can be fully configured. Each animation type also supports using keyframes in addition to just defining the starting and final values. - **Activities** on the other hand are a way to interleave an animation schedule with all sorts of custom logic, such as triggering other animations or running arbitrary code (eg. to update a visual state while an animation is running). -These two types of animation nodes implement several interfaces (such as [`ITimeline`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.ITimeline) and [`IActivity`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.IActivity)) which make this system extremely customizable and extensible for users as well for their own scenarios. +These two types of animation nodes implement several interfaces (such as `ITimeline` and `IActivity`) which make this system extremely customizable and extensible for users as well for their own scenarios. -Here is how a simple animation can be declared in XAML. In this case we are using `x:Name` so that we can reference it in code behind to start it when the button is clicked. The animation is also directly attached to the [`Button`](/windows/uwp/design/controls-and-patterns/buttons), so we can start it directly by calling the `Start()` method, without the need to specify the target element to animate. +Here is how a simple animation can be declared in XAML. In this case we are using `x:Name` so that we can reference it in code behind to start it when the button is clicked. The animation is also directly attached to the [`Button`](https://learn.microsoft.com/windows/uwp/design/controls-and-patterns/buttons), so we can start it directly by calling the `Start()` method, without the need to specify the target element to animate. ```xaml @@ -39,7 +39,7 @@ Here is how a simple animation can be declared in XAML. In this case we are usin ``` -By default, animations target the [Composition layer](/windows/uwp/composition/visual-layer) as it provides the best performance possible. It is also possible to explicitly target the XAML layer too though, which can enable things such as animating the color of a brush used to display some text in a `Button`. Here is an example where we use this functionality, together with explicit keyframes to have more fine-grained control over the animation to run: +By default, animations target the [Composition layer](https://learn.microsoft.com/windows/uwp/composition/visual-layer) as it provides the best performance possible. It is also possible to explicitly target the XAML layer too though, which can enable things such as animating the color of a brush used to display some text in a `Button`. Here is an example where we use this functionality, together with explicit keyframes to have more fine-grained control over the animation to run: ```xaml @@ -60,7 +60,7 @@ By default, animations target the [Composition layer](/windows/uwp/composition/v ``` -Keyframes (both when declared in C# and in XAML) can also use an [expression animation](/uwp/api/windows.ui.composition.expressionanimation) when they are being used in an animation targeting the Composition layer. This provides additional control over the animation values and allows consumers to create dynamic animations that can adapt to the current state of the target element. Here is an example: +Keyframes (both when declared in C# and in XAML) can also use an [expression animation](https://learn.microsoft.com/uwp/api/windows.ui.composition.expressionanimation) when they are being used in an animation targeting the Composition layer. This provides additional control over the animation values and allows consumers to create dynamic animations that can adapt to the current state of the target element. Here is an example: ```xaml @@ -80,7 +80,7 @@ Keyframes (both when declared in C# and in XAML) can also use an [expression ani Another feature of the `AnimationSet` type is the `IsSequential` property which configures the way top-level elements (animations, activities, and scopes) within the animation are handled. -When this property is set to `true` each top-level node will be executed sequentially and only move to the following one when the previous completes (and the animation has not been cancelled). This can be used in conjunction with the various `IActivity` objects to create custom animation schedules that combine multiple animations running on different UI elements, with all the synchronization still done entirely from XAML. It is also helpful when combined with an [`AnimationScope`](/dotnet/api/microsoft.toolkit.uwp.ui.animations.AnimationScope) in order to more easily parse the timeline of events within an animation when creating and modifying them. +When this property is set to `true` each top-level node will be executed sequentially and only move to the following one when the previous completes (and the animation has not been cancelled). This can be used in conjunction with the various `IActivity` objects to create custom animation schedules that combine multiple animations running on different UI elements, with all the synchronization still done entirely from XAML. It is also helpful when combined with an `AnimationScope` in order to more easily parse the timeline of events within an animation when creating and modifying them. Here is an example that showcases both the sequential mode for animations as well as the ability to combine animations and activities in the same schedule, and how different animations (even on different UI elements) can be combined and interleaved by using the available APIs: @@ -125,11 +125,11 @@ Here's an example of how all these various explicit animations can be combined t ## Behaviors -If you are also referencing the `Microsoft.Toolkit.Uwp.UI.Behaviors` package, it will be possible to also use behaviors and actions to better support the new APIs, such as by automatically triggering an animation when a given event is raised, entirely from XAML. There are four main types being introduced in this package that interoperate with the Animation APIs: +If you are also referencing the `Behaviors` package, it will be possible to also use behaviors and actions to better support the new APIs, such as by automatically triggering an animation when a given event is raised, entirely from XAML. There are four main types being introduced in this package that interoperate with the Animation APIs: -- [`AnimationStartedTriggerBehavior`](/dotnet/api/microsoft.toolkit.uwp.ui.behaviors.AnimationStartedTriggerBehavior) and [`AnimationCompletedTriggerBehavior`](/dotnet/api/microsoft.toolkit.uwp.ui.behaviors.AnimationCompletedTriggerBehavior): these are custom triggers that can be used to execute `IAction`-s when an `AnimationSet` starts or completes. All the built-in `IAction` objects can be used from the Behaviors package, as well as custom ones as well. -- [`StartAnimationAction`](/dotnet/api/microsoft.toolkit.uwp.ui.behaviors.StartAnimationAction): an `IAction` object that can be used within behaviors to easily start a target animation, either with an attached UI element or with an explicit target to animate. -- [`StopAnimationAction`](/dotnet/api/microsoft.toolkit.uwp.ui.behaviors.StopAnimationAction): an `IAction` object that can be used within behaviors to easily stop a target animation, either with an attached UI element or with an explicit target to animate. +- `AnimationStartedTriggerBehavior` and `AnimationCompletedTriggerBehavior`: these are custom triggers that can be used to execute `IAction`-s when an `AnimationSet` starts or completes. All the built-in `IAction` objects can be used from the Behaviors package, as well as custom ones as well. +- `StartAnimationAction`: an `IAction` object that can be used within behaviors to easily start a target animation, either with an attached UI element or with an explicit target to animate. +- `StopAnimationAction`: an `IAction` object that can be used within behaviors to easily stop a target animation, either with an attached UI element or with an explicit target to animate. Here is an example that shows how these new APIs can be used together: @@ -164,7 +164,7 @@ This makes it possible to also not having to name the target UI element, to regi ## Effect animations -Lastly, the `AnimationSet` class can also directly animate Composition/Win2D effects. To gain access to this feature, you will need to also reference the `Microsoft.Toolkit.Uwp.UI.Media`. This package includes some special animation types that can be plugged in into an `AnimationSet` instance and used to animate individual effects within a custom effects graph. This can then be used either from a [PipelineBrush](/dotnet/api/microsoft.toolkit.uwp.ui.media.pipelinebrush) or from an inline graph attached to a UI element through the [`PipelineVisualFactory`](/dotnet/api/microsoft.toolkit.uwp.ui.media.PipelineVisualFactory) type. All these effect animations are powered by the same `AnimationBuilder` type behind the scenes, and can facilitate creating complex animations on specific effects within a graph. +Lastly, the `AnimationSet` class can also directly animate Composition/Win2D effects. To gain access to this feature, you will need to also reference the `CommunityToolkit.WinUI.Media`. This package includes some special animation types that can be plugged in into an `AnimationSet` instance and used to animate individual effects within a custom effects graph. This can then be used either from a `PipelineBrush` or from an inline graph attached to a UI element through the `PipelineVisualFactory` type. All these effect animations are powered by the same `AnimationBuilder` type behind the scenes, and can facilitate creating complex animations on specific effects within a graph. Here is an example of how the new `PipelineVisualFactory` type can be combined with these effect animations: diff --git a/components/Behaviors/samples/Behaviors.Samples.csproj b/components/Behaviors/samples/Behaviors.Samples.csproj index 77030400..54c8f0b2 100644 --- a/components/Behaviors/samples/Behaviors.Samples.csproj +++ b/components/Behaviors/samples/Behaviors.Samples.csproj @@ -1,4 +1,6 @@ - + + + Behaviors diff --git a/components/Behaviors/samples/Behaviors.md b/components/Behaviors/samples/Behaviors.md index f410cb55..6e507a66 100644 --- a/components/Behaviors/samples/Behaviors.md +++ b/components/Behaviors/samples/Behaviors.md @@ -29,6 +29,7 @@ The AutoSelectBehavior automatically selects the entire content of its associate > [!Sample AutoSelectBehaviorSample] ## ViewportBehavior + This behavior allows you to listen an element enter or exit the ScrollViewer viewport. > [!Sample ViewportBehaviorSample] @@ -44,6 +45,7 @@ Empty lists do not receive focus: > [!Sample FocusBehaviorListSample] ## NavigateToUriAction -This behavior allows you to define a Uri in XAML, similiar to a `Hyperlink` or `HyperlinkButton`. This allows you to use a `Button` and still define the Uri in XAML without wiring up the `Click` event in code-behind, or restyling a `HyperlinkButton`. + +This behavior allows you to define a Uri in XAML, similar to a `Hyperlink` or `HyperlinkButton`. This allows you to use a `Button` and still define the Uri in XAML without wiring up the `Click` event in code-behind, or restyling a `HyperlinkButton`. > [!Sample NavigateToUriActionSample] diff --git a/components/Behaviors/samples/Headers/HeaderBehaviors.md b/components/Behaviors/samples/HeaderBehaviors.md similarity index 100% rename from components/Behaviors/samples/Headers/HeaderBehaviors.md rename to components/Behaviors/samples/HeaderBehaviors.md diff --git a/components/Behaviors/samples/Headers/FadeHeaderBehaviorSample.xaml b/components/Behaviors/samples/Headers/FadeHeaderBehaviorSample.xaml index af2f4ae8..3017c101 100644 --- a/components/Behaviors/samples/Headers/FadeHeaderBehaviorSample.xaml +++ b/components/Behaviors/samples/Headers/FadeHeaderBehaviorSample.xaml @@ -1,4 +1,4 @@ - /// An empty page that can be used on its own or navigated to within a Frame. diff --git a/components/Behaviors/samples/Headers/QuickReturnHeaderBehaviorSample.xaml b/components/Behaviors/samples/Headers/QuickReturnHeaderBehaviorSample.xaml index 39f95e6f..36c66603 100644 --- a/components/Behaviors/samples/Headers/QuickReturnHeaderBehaviorSample.xaml +++ b/components/Behaviors/samples/Headers/QuickReturnHeaderBehaviorSample.xaml @@ -1,4 +1,4 @@ - /// An empty page that can be used on its own or navigated to within a Frame. diff --git a/components/Behaviors/samples/Headers/QuickReturnScrollViewerSample.xaml b/components/Behaviors/samples/Headers/QuickReturnScrollViewerSample.xaml index 5528ff53..86104a96 100644 --- a/components/Behaviors/samples/Headers/QuickReturnScrollViewerSample.xaml +++ b/components/Behaviors/samples/Headers/QuickReturnScrollViewerSample.xaml @@ -1,4 +1,4 @@ - /// An empty page that can be used on its own or navigated to within a Frame. diff --git a/components/Behaviors/samples/Headers/StickyHeaderBehaviorSample.xaml b/components/Behaviors/samples/Headers/StickyHeaderBehaviorSample.xaml index 61438908..160a6125 100644 --- a/components/Behaviors/samples/Headers/StickyHeaderBehaviorSample.xaml +++ b/components/Behaviors/samples/Headers/StickyHeaderBehaviorSample.xaml @@ -1,11 +1,11 @@ - diff --git a/components/Behaviors/samples/Headers/StickyHeaderBehaviorSample.xaml.cs b/components/Behaviors/samples/Headers/StickyHeaderBehaviorSample.xaml.cs index 49c1ba53..32a33631 100644 --- a/components/Behaviors/samples/Headers/StickyHeaderBehaviorSample.xaml.cs +++ b/components/Behaviors/samples/Headers/StickyHeaderBehaviorSample.xaml.cs @@ -4,7 +4,7 @@ using CommunityToolkit.WinUI.Behaviors; -namespace BehaviorsExperiment.Samples; +namespace BehaviorsExperiment.Samples.Headers; /// /// An empty page that can be used on its own or navigated to within a Frame. diff --git a/components/Behaviors/samples/Headers/StickyHeaderItemsControlSample.xaml b/components/Behaviors/samples/Headers/StickyHeaderItemsControlSample.xaml index c594d072..9f5fcf93 100644 --- a/components/Behaviors/samples/Headers/StickyHeaderItemsControlSample.xaml +++ b/components/Behaviors/samples/Headers/StickyHeaderItemsControlSample.xaml @@ -1,4 +1,4 @@ - /// An empty page that can be used on its own or navigated to within a Frame. diff --git a/components/Behaviors/samples/StackedNotificationsBehaviorCustomSample.xaml b/components/Behaviors/samples/Notifications/StackedNotificationsBehaviorCustomSample.xaml similarity index 92% rename from components/Behaviors/samples/StackedNotificationsBehaviorCustomSample.xaml rename to components/Behaviors/samples/Notifications/StackedNotificationsBehaviorCustomSample.xaml index 1c57592f..3f93215e 100644 --- a/components/Behaviors/samples/StackedNotificationsBehaviorCustomSample.xaml +++ b/components/Behaviors/samples/Notifications/StackedNotificationsBehaviorCustomSample.xaml @@ -1,5 +1,5 @@ - - + + + + Behaviors This package contains Behaviors. CommunityToolkit.WinUI.BehaviorsRns + ReadMe.md - - + + True + \ + + + + + + diff --git a/components/Behaviors/src/ReadMe.md b/components/Behaviors/src/ReadMe.md new file mode 100644 index 00000000..7a6176b1 --- /dev/null +++ b/components/Behaviors/src/ReadMe.md @@ -0,0 +1,39 @@ + +# Windows Community Toolkit - Behaviors + +This package is part of the [Windows Community Toolkit](https://aka.ms/toolkit/windows) from the [.NET Foundation](https://dotnetfoundation.org). + +## Package Contents + +This package contains the following in the `CommunityToolkit.WinUI.Behaviors` namespace: + +- AnimationCompletedTriggerBehavior +- AnimationStartedTriggerBehavior +- AutoSelectBehavior +- FadeHeaderBehavior +- FocusBehavior +- InvokeActionsActivity +- KeyDownTriggerBehavior +- NavigateToUriAction +- QuickReturnHeaderBehavior +- StartAnimationAction +- StackedNotificationBehavior +- StopAnimationAction +- StickyHeaderBehavior +- ViewportBehavior + +## Which Package is for me? + +If you're developing with _UWP/WinUI 2 or Uno.UI_ you should be using the `CommunityToolkit.Uwp.Behaviors` package. + +If you're developing with _WindowsAppSDK/WinUI 3 or Uno.WinUI_ you should be using the `CommunityToolkit.WinUI.Behaviors` package. + +## Documentation + +Further documentation about these components can be found at: https://aka.ms/windowstoolkitdocs + +## License + +MIT + +See License.md in package for more details. diff --git a/components/Behaviors/tests/Behaviors.Tests.projitems b/components/Behaviors/tests/Behaviors.Tests.projitems index c21c6464..f1188398 100644 --- a/components/Behaviors/tests/Behaviors.Tests.projitems +++ b/components/Behaviors/tests/Behaviors.Tests.projitems @@ -9,20 +9,12 @@ BehaviorsExperiment.Tests - - - ExampleBehaviorsTestPage.xaml - StackedNotificationsBehaviorsTestPage.xaml - - Designer - MSBuild:Compile - Designer MSBuild:Compile diff --git a/components/Behaviors/tests/ExampleBehaviorsTestClass.cs b/components/Behaviors/tests/ExampleBehaviorsTestClass.cs deleted file mode 100644 index c22c3397..00000000 --- a/components/Behaviors/tests/ExampleBehaviorsTestClass.cs +++ /dev/null @@ -1,41 +0,0 @@ -// 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.Tests; -using CommunityToolkit.Tests.Internal; -using CommunityToolkit.Tooling.TestGen; - -namespace BehaviorsExperiment.Tests; - -[TestClass] -public partial class ExampleBehaviorsTestClass : VisualUITestBase -{ - // The UIThreadTestMethod can also easily grab a XAML Page for us by passing its type as a parameter. - // This lets us actually test a control as it would behave within an actual application. - // The page will already be loaded by the time your test is called. - [UIThreadTestMethod] - public void SimpleUIExamplePageTest(ExampleBehaviorsTestPage page) - { - // You can use the Toolkit Visual Tree helpers here to find the component by type or name: - /*var component = page.FindDescendant(); - - Assert.IsNotNull(component); - - var componentByName = page.FindDescendant("BehaviorsControl"); - - Assert.IsNotNull(componentByName);*/ - } - - // You can still do async work with a UIThreadTestMethod as well. - [UIThreadTestMethod] - public async Task SimpleAsyncUIExamplePageTest(ExampleBehaviorsTestPage page) - { - // This helper can be used to wait for a rendering pass to complete. - await CompositionTargetHelper.ExecuteAfterCompositionRenderingAsync(() => { }); - - /*var component = page.FindDescendant(); - - Assert.IsNotNull(component);*/ - } -} diff --git a/components/CameraPreview/samples/CameraPreview.Samples.csproj b/components/CameraPreview/samples/CameraPreview.Samples.csproj index a59ac957..1cb955f0 100644 --- a/components/CameraPreview/samples/CameraPreview.Samples.csproj +++ b/components/CameraPreview/samples/CameraPreview.Samples.csproj @@ -1,4 +1,6 @@ - + + + CameraPreview diff --git a/components/CameraPreview/samples/CameraPreview.md b/components/CameraPreview/samples/CameraPreview.md index 9b863b11..9475d19b 100644 --- a/components/CameraPreview/samples/CameraPreview.md +++ b/components/CameraPreview/samples/CameraPreview.md @@ -6,14 +6,14 @@ keywords: CameraPreview, Control, skommireddi dev_langs: - csharp category: Controls -subcategory: Layout +subcategory: Media discussion-id: 0 issue-id: 0 icon: Assets/CameraPreview.png --- > [!IMPORTANT] -> Make sure you have the [webcam capability](/windows/uwp/packaging/app-capability-declarations#device-capabilities) enabled for your app to access the device's camera. +> Make sure you have the [webcam capability](https://learn.microsoft.com/windows/uwp/packaging/app-capability-declarations#device-capabilities) enabled for your app to access the device's camera. > [!Sample CameraPreviewSample] @@ -45,7 +45,6 @@ private void CameraPreviewControl_PreviewFailed(object sender, PreviewFailedEven > [!IMPORTANT] > As a developer, you will need to make sure the CameraHelper resources used by the control are cleaned up when appropriate. See [CameraHelper documentation](../helpers/CameraHelper.md) for more details - ## Examples Demonstrates using the camera control and camera helper to preview video from a specific media frame source group. diff --git a/components/CameraPreview/samples/CameraPreviewSample.xaml b/components/CameraPreview/samples/CameraPreviewSample.xaml index 55dc1101..09c3bac8 100644 --- a/components/CameraPreview/samples/CameraPreviewSample.xaml +++ b/components/CameraPreview/samples/CameraPreviewSample.xaml @@ -1,4 +1,4 @@ - +