Skip to content

Commit e02308b

Browse files
committed
Switched to AcrylicBrush in all loading samples
1 parent 232e5da commit e02308b

File tree

2 files changed

+16
-23
lines changed

2 files changed

+16
-23
lines changed

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
44
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
55
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
6+
xmlns:brushes="using:Microsoft.Toolkit.Uwp.UI.Media"
67
mc:Ignorable="d">
78

89
<Page.Resources>
@@ -37,7 +38,7 @@
3738

3839
<Grid>
3940

40-
<ScrollViewer x:Name="ScrollViewerControl">
41+
<ScrollViewer>
4142
<StackPanel Margin="20">
4243
<RichTextBlock Margin="0,10,0,0">
4344
<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>
@@ -50,19 +51,22 @@
5051
</RichTextBlock>
5152

5253
<controls:AdaptiveGridView
53-
Margin="0,12,0,0"
54-
x:Name="AdaptiveGridViewControl"
55-
ItemHeight="200"
56-
DesiredWidth="300"
57-
SelectionMode="None"
58-
IsItemClickEnabled="False"
59-
ItemTemplate="{StaticResource PhotosTemplate}" />
54+
Margin="0,12,0,0"
55+
x:Name="AdaptiveGridViewControl"
56+
ItemHeight="200"
57+
DesiredWidth="300"
58+
SelectionMode="None"
59+
IsItemClickEnabled="False"
60+
ItemTemplate="{StaticResource PhotosTemplate}" />
6061
</StackPanel>
6162
</ScrollViewer>
6263

6364
<controls:Loading x:Name="LoadingControl">
6465
<controls:Loading.Background>
65-
<SolidColorBrush Color="@[Background:Brush:Black]" Opacity="@[Background Opacity:DoubleSlider:0.7:0-1]" />
66+
<brushes:AcrylicBrush BackgroundSource="Backdrop"
67+
TintColor="Black"
68+
TintOpacity="@[Opacity:DoubleSlider:0.4:0.0-1.0]"
69+
BlurAmount="@[BlurAmount:DoubleSlider:8:0.0-32.0]"/>
6670
</controls:Loading.Background>
6771
<ContentControl x:Name="LoadingContentControl" />
6872
</controls:Loading>

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

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.Threading.Tasks;
6-
using Microsoft.Toolkit.Uwp.UI.Animations;
76
using Microsoft.Toolkit.Uwp.UI.Controls;
87
using Microsoft.Toolkit.Uwp.UI.Extensions;
98
using Windows.UI.Xaml;
@@ -13,8 +12,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
1312
{
1413
public sealed partial class LoadingPage : IXamlRenderListener
1514
{
16-
private ScrollViewer scrollViewerControl;
17-
private AdaptiveGridView adaptiveGridViewControl;
1815
private Loading loadingControl;
1916
private ContentControl loadingContentControl;
2017
private ResourceDictionary resources;
@@ -27,15 +24,13 @@ public LoadingPage()
2724

2825
public async void OnXamlRendered(FrameworkElement control)
2926
{
30-
scrollViewerControl = control.FindChildByName("ScrollViewerControl") as ScrollViewer;
31-
adaptiveGridViewControl = control.FindChildByName("AdaptiveGridViewControl") as AdaptiveGridView;
3227
loadingControl = control.FindDescendantByName("LoadingControl") as Loading;
3328
loadingContentControl = control.FindChildByName("LoadingContentControl") as ContentControl;
3429
resources = control.Resources;
3530

36-
if (adaptiveGridViewControl != null)
31+
if (control.FindChildByName("AdaptiveGridViewControl") is AdaptiveGridView gridView)
3732
{
38-
adaptiveGridViewControl.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();
33+
gridView.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();
3934
}
4035
}
4136

@@ -59,18 +54,12 @@ private void Load()
5954
}
6055
});
6156

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) =>
6358
{
6459
if (loadingContentControl != null)
6560
{
6661
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();
7262
await ShowLoadingDialogAsync();
73-
await scrollViewerControl.Blur(0, 0).StartAsync();
7463
}
7564
});
7665
}

0 commit comments

Comments
 (0)