Skip to content

Commit 1ad70b4

Browse files
author
msftbot[bot]
authored
Add extensions support for CompositionConditionalValue (#3605)
<!-- 🚨 Please Do Not skip any instructions and information mentioned below as they are all required and essential to evaluate and test the PR. By fulfilling all the required information you will be able to reduce the volume of questions and most likely help merge the PR faster 🚨 --> <!-- 📝 It is preferred if you keep the "☑️ Allow edits by maintainers" checked in the Pull Request Template as it increases collaboration with the Toolkit maintainers by permitting commits to your PR branch (only) created from your fork. This can let us quickly make fixes for minor typos or forgotten StyleCop issues during review without needing to wait on you doing extra work. Let us help you help us! 🎉 --> ## Fixes # <!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. --> <!-- Add a brief overview here of the feature/bug & fix. --> Currently the toolkit has helpers for creating expression animations for InteractionTrackerInertiaRestingValue, InteractionTrackerInertiaMotion... but there are no equivalent extension methods for working with the similar CompositionConditionalValue (which is used to configure CenterPoint modifiers for InteractionTrackers/VisualInteractionSources). This PR adds the same extension methods that already exist for the former types to the latter. ## PR Type What kind of change does this PR introduce? <!-- Please uncomment one or more that apply to this PR. --> <!-- - Bugfix --> Feature <!-- - Code style update (formatting) --> <!-- - Refactoring (no functional changes, no api changes) --> <!-- - Build or CI related changes --> <!-- - Documentation content changes --> <!-- - Sample app changes --> <!-- - Other... Please describe: --> ## What is the current behavior? There are no extension methods for working with CompositionConditionalValue ## What is the new behavior? The same extensions that are available for other modifiers are now available for CompositionConditionalValue ## PR Checklis Please check if your PR fulfills the following requirements: - [X] Tested code with current [supported SDKs](../readme.md#supported) - [X] Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: https://github.com/MicrosoftDocs/WindowsCommunityToolkitDocs/pull/410/files - N/A Sample in sample app has been added / updated (for bug fixes / features) - N/A Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets) - N/A Tests for the changes have been added (for bug fixes / features) (if applicable) - N/A Header has been added to all new source files (run *build/UpdateHeaders.bat*) - [X] Contains **NO** breaking changes <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. Please note that breaking changes are likely to be rejected within minor release cycles or held until major versions. --> ## Other information
2 parents 97fd126 + 6c8692b commit 1ad70b4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Microsoft.Toolkit.Uwp.UI.Animations/Expressions/CompositionExtensions.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,26 @@ public static void SetMotion(this InteractionTrackerInertiaMotion modifier, Expr
221221
modifier.Motion = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
222222
}
223223

224+
/// <summary>
225+
/// Use the value of specified ExpressionNode to determine if this composition conditional value modifier should be chosen.
226+
/// </summary>
227+
/// <param name="modifier">The modifier.</param>
228+
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
229+
public static void SetCondition(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
230+
{
231+
modifier.Condition = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
232+
}
233+
234+
/// <summary>
235+
/// Use the value of specified ExpressionNode as the value for this composition conditional value
236+
/// </summary>
237+
/// <param name="modifier">The modifier.</param>
238+
/// <param name="expressionNode">The root ExpressionNode that represents the ExpressionAnimation.</param>
239+
public static void SetValue(this CompositionConditionalValue modifier, ExpressionNode expressionNode)
240+
{
241+
modifier.Value = CreateExpressionAnimationFromNode(modifier.Compositor, expressionNode);
242+
}
243+
224244
/// <summary>
225245
/// Creates the expression animation from node.
226246
/// </summary>

0 commit comments

Comments
 (0)