3
3
// See the LICENSE file in the project root for more information.
4
4
5
5
using System . Threading . Tasks ;
6
- using Microsoft . Toolkit . Uwp . UI . Animations ;
7
6
using Microsoft . Toolkit . Uwp . UI . Controls ;
8
7
using Microsoft . Toolkit . Uwp . UI . Extensions ;
9
8
using Windows . UI . Xaml ;
@@ -13,8 +12,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
13
12
{
14
13
public sealed partial class LoadingPage : IXamlRenderListener
15
14
{
16
- private ScrollViewer scrollViewerControl ;
17
- private AdaptiveGridView adaptiveGridViewControl ;
18
15
private Loading loadingControl ;
19
16
private ContentControl loadingContentControl ;
20
17
private ResourceDictionary resources ;
@@ -27,15 +24,13 @@ public LoadingPage()
27
24
28
25
public async void OnXamlRendered ( FrameworkElement control )
29
26
{
30
- scrollViewerControl = control . FindChildByName ( "ScrollViewerControl" ) as ScrollViewer ;
31
- adaptiveGridViewControl = control . FindChildByName ( "AdaptiveGridViewControl" ) as AdaptiveGridView ;
32
27
loadingControl = control . FindDescendantByName ( "LoadingControl" ) as Loading ;
33
28
loadingContentControl = control . FindChildByName ( "LoadingContentControl" ) as ContentControl ;
34
29
resources = control . Resources ;
35
30
36
- if ( adaptiveGridViewControl != null )
31
+ if ( control . FindChildByName ( "AdaptiveGridViewControl" ) is AdaptiveGridView gridView )
37
32
{
38
- adaptiveGridViewControl . ItemsSource = await new Data . PhotosDataSource ( ) . GetItemsAsync ( ) ;
33
+ gridView . ItemsSource = await new Data . PhotosDataSource ( ) . GetItemsAsync ( ) ;
39
34
}
40
35
}
41
36
@@ -59,18 +54,12 @@ private void Load()
59
54
}
60
55
} ) ;
61
56
62
- SampleController . Current . RegisterNewCommand ( "Loading control with logo and blurring when requested " , async ( sender , args ) =>
57
+ SampleController . Current . RegisterNewCommand ( "Loading control with logo" , async ( sender , args ) =>
63
58
{
64
59
if ( loadingContentControl != null )
65
60
{
66
61
loadingContentControl . ContentTemplate = resources [ "LogoTemplate" ] as DataTemplate ;
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 ( ) ;
72
62
await ShowLoadingDialogAsync ( ) ;
73
- await scrollViewerControl . Blur ( 0 , 0 ) . StartAsync ( ) ;
74
63
}
75
64
} ) ;
76
65
}
0 commit comments