Skip to content

Commit a7f8976

Browse files
author
msftbot[bot]
authored
Fixed incorrect blur in loading sample (#3488)
## Fixes #3359 <!-- Add the relevant issue number after the "#" mentioned above (for ex: Fixes #1234) which will automatically close the issue once the PR is merged. --> <!-- Add a brief overview here of the feature/bug & fix. --> ## PR Type What kind of change does this PR introduce? <!-- Please uncomment one or more that apply to this PR. --> - Bugfix - Sample app changes <!-- - Other... Please describe: --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. --> The blur is incorrectly applied to the loading icon on top of the sample page content: ![image](https://user-images.githubusercontent.com/10199417/93781807-0cb16600-fc2a-11ea-9336-d286bcae3aa0.png) ## What is the new behavior? <!-- Describe how was this issue resolved or changed? --> The blur is now applied to the content of the page, with the icon being clearly visible: ![image](https://user-images.githubusercontent.com/10199417/93781861-1fc43600-fc2a-11ea-905d-7e2b82210361.png) ## PR Checklist Please check if your PR fulfills the following requirements: - [X] Tested code with current [supported SDKs](../readme.md#supported) - [ ] ~~Pull Request has been submitted to the documentation repository [instructions](..\contributing.md#docs). Link: <!-- docs PR link -->~~ - [X] Sample in sample app has been added / updated (for bug fixes / features) - [ ] ~~Icon has been created (if new sample) following the [Thumbnail Style Guide and templates](https://github.com/windows-toolkit/WindowsCommunityToolkit-design-assets)~~ - [ ] ~~Tests for the changes have been added (for bug fixes / features) (if applicable)~~ - [ ] ~~Header has been added to all new source files (run *build/UpdateHeaders.bat*)~~ - [ ] ~~Contains **NO** breaking changes~~
2 parents ca461ca + ea2dd57 commit a7f8976

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

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

Lines changed: 12 additions & 8 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>
@@ -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-24.0]"/>
6670
</controls:Loading.Background>
6771
<ContentControl x:Name="LoadingContentControl" />
6872
</controls:Loading>

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

Lines changed: 4 additions & 9 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,7 +12,6 @@ namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
1312
{
1413
public sealed partial class LoadingPage : IXamlRenderListener
1514
{
16-
private AdaptiveGridView adaptiveGridViewControl;
1715
private Loading loadingControl;
1816
private ContentControl loadingContentControl;
1917
private ResourceDictionary resources;
@@ -26,14 +24,13 @@ public LoadingPage()
2624

2725
public async void OnXamlRendered(FrameworkElement control)
2826
{
29-
adaptiveGridViewControl = control.FindChildByName("AdaptiveGridViewControl") as AdaptiveGridView;
3027
loadingControl = control.FindDescendantByName("LoadingControl") as Loading;
3128
loadingContentControl = control.FindChildByName("LoadingContentControl") as ContentControl;
3229
resources = control.Resources;
3330

34-
if (adaptiveGridViewControl != null)
31+
if (control.FindChildByName("AdaptiveGridViewControl") is AdaptiveGridView gridView)
3532
{
36-
adaptiveGridViewControl.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();
33+
gridView.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();
3734
}
3835
}
3936

@@ -57,22 +54,20 @@ private void Load()
5754
}
5855
});
5956

60-
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) =>
6158
{
6259
if (loadingContentControl != null)
6360
{
6461
loadingContentControl.ContentTemplate = resources["LogoTemplate"] as DataTemplate;
65-
await loadingContentControl.Blur(2, 100).StartAsync();
6662
await ShowLoadingDialogAsync();
67-
await loadingContentControl.Blur(0, 0).StartAsync();
6863
}
6964
});
7065
}
7166

7267
private async Task ShowLoadingDialogAsync()
7368
{
7469
loadingControl.IsLoading = true;
75-
await Task.Delay(3000);
70+
await Task.Delay(5000);
7671
loadingControl.IsLoading = false;
7772
}
7873
}

0 commit comments

Comments
 (0)