Skip to content

Commit 232e5da

Browse files
committed
Fixed incorrect blur in loading sample
1 parent ca461ca commit 232e5da

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Loading/LoadingCode.bind

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
<Grid>
3939

40-
<ScrollViewer>
40+
<ScrollViewer x:Name="ScrollViewerControl">
4141
<StackPanel Margin="20">
4242
<RichTextBlock Margin="0,10,0,0">
4343
<Paragraph FontSize="18" FontWeight="Bold">The loading control is for showing an animation with some content when the user should wait in some tasks of the app.</Paragraph>

Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Loading/LoadingPage.xaml.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
1313
{
1414
public sealed partial class LoadingPage : IXamlRenderListener
1515
{
16+
private ScrollViewer scrollViewerControl;
1617
private AdaptiveGridView adaptiveGridViewControl;
1718
private Loading loadingControl;
1819
private ContentControl loadingContentControl;
@@ -26,6 +27,7 @@ public LoadingPage()
2627

2728
public async void OnXamlRendered(FrameworkElement control)
2829
{
30+
scrollViewerControl = control.FindChildByName("ScrollViewerControl") as ScrollViewer;
2931
adaptiveGridViewControl = control.FindChildByName("AdaptiveGridViewControl") as AdaptiveGridView;
3032
loadingControl = control.FindDescendantByName("LoadingControl") as Loading;
3133
loadingContentControl = control.FindChildByName("LoadingContentControl") as ContentControl;
@@ -62,9 +64,13 @@ private void Load()
6264
if (loadingContentControl != null)
6365
{
6466
loadingContentControl.ContentTemplate = resources["LogoTemplate"] as DataTemplate;
65-
await loadingContentControl.Blur(2, 100).StartAsync();
67+
68+
// We need to blur the ScrollViewer hosting the main content of the page and not the
69+
// root control, otherwise the popup with the icon would be blurred as well, as it
70+
// would be in the same visual tree as the control whose visual is being blurred.
71+
await scrollViewerControl.Blur(2, 100).StartAsync();
6672
await ShowLoadingDialogAsync();
67-
await loadingContentControl.Blur(0, 0).StartAsync();
73+
await scrollViewerControl.Blur(0, 0).StartAsync();
6874
}
6975
});
7076
}

0 commit comments

Comments
 (0)