Skip to content

Commit

Permalink
Fix issue with ProgressRing not animating after being unloaded (#6775)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelwgn authored Mar 2, 2022
1 parent 0b8152b commit b8eb652
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dev/ProgressRing/ProgressRing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ProgressRing::ProgressRing()
SetValue(s_TemplateSettingsProperty, winrt::make<::ProgressRingTemplateSettings>());

SizeChanged({ this, &ProgressRing::OnSizeChanged });
Loaded({ this, &ProgressRing::OnLoaded });
}

winrt::AutomationPeer ProgressRing::OnCreateAutomationPeer()
Expand Down Expand Up @@ -65,6 +66,11 @@ void ProgressRing::OnSizeChanged(const winrt::IInspectable&, const winrt::IInspe
ApplyTemplateSettings();
}

void ProgressRing::OnLoaded(const winrt::IInspectable&, const winrt::IInspectable&)
{
UpdateStates();
}

void ProgressRing::OnForegroundPropertyChanged(const winrt::DependencyObject&, const winrt::DependencyProperty&)
{
if (const auto foreground = Foreground().try_as<winrt::SolidColorBrush>())
Expand Down
1 change: 1 addition & 0 deletions dev/ProgressRing/ProgressRing.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ProgressRing :
void SetLottieForegroundColor(const winrt::IAnimatedVisualSource);
void SetLottieBackgroundColor(const winrt::IAnimatedVisualSource);
void OnSizeChanged(const winrt::IInspectable&, const winrt::IInspectable&);
void OnLoaded(const winrt::IInspectable&, const winrt::IInspectable&);
void UpdateStates();
void ApplyTemplateSettings();
void UpdateLottieProgress();
Expand Down
2 changes: 2 additions & 0 deletions dev/TabView/TestUI/TabViewPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,15 @@
<StackPanel Padding="16" Background="{ThemeResource TabViewItemHeaderBackgroundSelected}">
<TextBlock>Shop text</TextBlock>
<Button Content="SecondTabButton" AutomationProperties.Name="SecondTabButton"/>
<controls:ProgressRing IsActive="True"/>
</StackPanel>
</controls:TabViewItem>

<controls:TabViewItem x:Name="LongHeaderTab" AutomationProperties.Name="LongHeaderTab" Header="Long Header No Icon">
<StackPanel Padding="16" Background="{ThemeResource TabViewItemHeaderBackgroundSelected}">
<TextBlock >Emoji text</TextBlock>
<Button Content="Button 3"/>
<controls:ProgressRing IsActive="True"/>
</StackPanel>
</controls:TabViewItem>

Expand Down

0 comments on commit b8eb652

Please sign in to comment.