-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] Animations for Width and Height properties not working in WinUI 3 #10263
Labels
Comments
microsoft-github-policy-service
bot
added
the
needs-triage
Issue needs to be triaged by the area owners
label
Dec 30, 2024
It works with Test with MSDN sample : |
microsoft-github-policy-service
bot
added
needs-triage
Issue needs to be triaged by the area owners
and removed
needs-triage
Issue needs to be triaged by the area owners
labels
Dec 31, 2024
The animation is working well after adding <?xml version="1.0" encoding="utf-8"?>
<Window
x:Class="WinUiLearn.WindowKeyFrame"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WinUiLearn"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="WindowKeyFrame">
<Grid>
<Grid.Resources>
<Storyboard x:Name="rectangleStoryboard">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="animatedRectangle" Storyboard.TargetProperty="(Canvas.Left)">
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0" />
<LinearDoubleKeyFrame Value="300" KeyTime="0:0:2" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:4" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="animatedRectangle" Storyboard.TargetProperty="(Canvas.Top)">
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:0" />
<LinearDoubleKeyFrame Value="200" KeyTime="0:0:2" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:4" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Name="rectangleStoryboard2">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="animatedRectangle2" Storyboard.TargetProperty="Width" EnableDependentAnimation="true">
<LinearDoubleKeyFrame Value="50" KeyTime="0:0:0" />
<LinearDoubleKeyFrame Value="300" KeyTime="0:0:2" />
<LinearDoubleKeyFrame Value="50" KeyTime="0:0:4" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="animatedRectangle2" Storyboard.TargetProperty="Height" EnableDependentAnimation="true">
<LinearDoubleKeyFrame Value="50" KeyTime="0:0:0" />
<LinearDoubleKeyFrame Value="200" KeyTime="0:0:2" />
<LinearDoubleKeyFrame Value="50" KeyTime="0:0:4" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<Canvas>
<Rectangle x:Name="animatedRectangle" Width="50" Height="50" Fill="Blue" />
<Rectangle x:Name="animatedRectangle2" Width="50" Height="50" Canvas.Left="50" Fill="Red" />
<Button Content="Start Animation" Click="StartAnimation_Click" Canvas.Left="120" Canvas.Top="10" Background="Purple" />
</Canvas>
</Grid>
</Window> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
Animations for the
Width
andHeight
properties of aRectangle
do not work in WinUI 3. The animations are defined usingDoubleAnimationUsingKeyFrames
, but they do not have any effect on theRectangle
.Steps to reproduce the bug
Steps to reproduce the bug
Rectangle
and aStoryboard
to animate itsWidth
andHeight
properties:WindowKeyframe.xaml
WindowKeyframe.xaml.cs
Expected behavior
Expected behavior
The
Width
andHeight
properties of theRectangle
should animate as defined in theStoryboard
.Actual behavior
The
Width
andHeight
properties of theRectangle
do not change.Version Info
Additional context
Copy the code from the offical demo not work
How to: Animate the Size of a FrameworkElement
Screenshots
NuGet package version
None
Windows version
No response
Additional context
dotnet list pakage
OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.26100 N/A Build 26100
The text was updated successfully, but these errors were encountered: