Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bcc05a4
Add loading control on UI.Controls
soydachi Aug 25, 2016
ebd9cce
Add loading control son samples.json and refactor code adapting style
soydachi Aug 25, 2016
8836f88
Implement sample of loading control
soydachi Aug 26, 2016
732f0c5
Add loading image, implement properties for loading control customizatin
soydachi Aug 26, 2016
f689df8
Merged feature/LoadingControl into dev
soydachi Aug 26, 2016
002dcff
fetch upstream dev branch to forked repository
soydachi Aug 26, 2016
fa49e92
Apply nameof and removing this. Adding Loading.xaml template
soydachi Aug 26, 2016
6148fd1
Refactor loading control and add a default template
soydachi Aug 29, 2016
69697dc
Merged feature/LoadingControlImprovements into dev
soydachi Aug 29, 2016
82a7140
Merged branch dev into dev
soydachi Aug 29, 2016
75db927
Remove designer in SampleApp.csproj
soydachi Aug 29, 2016
1ebf5d2
Improve loading sample in SampleApp project.
soydachi Aug 30, 2016
601fc9d
Merged branch dev into dev
soydachi Aug 30, 2016
84f2bd7
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Aug 31, 2016
b58aca4
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Sep 11, 2016
f29401d
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Oct 20, 2016
e79c07f
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Nov 1, 2016
5da6ea1
include upstream/dev files
soydachi Nov 1, 2016
0c6c077
update headers with .\build.ps1
soydachi Nov 1, 2016
0c2c7d3
add handler for loadingRequired and fixing namesapces who throw error
soydachi Nov 1, 2016
4224209
avoid errors in ResizeBehaviorPage.g.i.cs
soydachi Nov 1, 2016
491f2b9
adding first delegate for loadingrequired
soydachi Nov 4, 2016
5a94a19
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Nov 4, 2016
e3c6e22
add loading documentation
soydachi Nov 4, 2016
8dbd4cc
add loading gif and updated Loading.md
soydachi Nov 4, 2016
6a88090
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Nov 4, 2016
dd06da0
add comments and fix PropertyDescriptor namespace
soydachi Nov 4, 2016
7ae1949
Refactor loading control with @skendrot suggestions
soydachi Nov 11, 2016
a1e170f
fixing SampleApp.csproj include contents
soydachi Nov 11, 2016
ee2c4e8
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Nov 11, 2016
033716c
Updating LoadingCode.bind
soydachi Nov 12, 2016
1f0a6a4
updated loading docs
soydachi Dec 6, 2016
c45a336
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Dec 6, 2016
26174a5
LoadingCode.bin to content
soydachi Dec 6, 2016
dd13fc1
update names and undo AdaptiveGridViewPage usings.
soydachi Dec 6, 2016
ddedd7d
removed LoadingRequired event
soydachi Dec 6, 2016
7585cca
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Dec 7, 2016
06e9ccb
Merge remote-tracking branch 'refs/remotes/upstream/dev'
soydachi Jan 22, 2017
13aa821
remove unnecesary code
soydachi Jan 22, 2017
cf09a0b
Update ResizeBehaviorPage.xaml.cs
soydachi Jan 25, 2017
195a3c1
fix little typos and bind BorderBrush and BorderThickness
soydachi Jan 25, 2017
f78a6a6
Merged branch dev into dev
soydachi Jan 25, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
<Content Include="SamplePages\Incremental Loading Collection\icon.png" />
<Content Include="SamplePages\Light\LightBehavior.png" />
<Content Include="SamplePages\LinkedIn Service\LinkedInLogo.png" />
<Content Include="SamplePages\Loading\Loading.png" />
<Content Include="SamplePages\MasterDetailsView\MasterDetailsView.png" />
<Content Include="SamplePages\Microsoft Graph Service\OfficeLogo.png" />
<Content Include="SamplePages\Microsoft Graph Service\user.png" />
Expand Down Expand Up @@ -344,6 +345,7 @@
<Content Include="SamplePages\PrintHelper\PrintHelperCode.bind" />
<Content Include="SamplePages\SystemInformation\SystemInformationCode.bind" />
<Content Include="SamplePages\DispatcherHelper\DispatcherHelperCode.bind" />
<Content Include="SamplePages\Loading\LoadingCode.bind" />
<Content Include="SamplePages\ReorderGridAnimation\ReorderGrid.bind" />
<Content Include="SamplePages\Light\LightBehaviorCode.bind" />
<Content Include="SamplePages\Light\LightBehaviorXaml.bind" />
Expand Down Expand Up @@ -439,6 +441,9 @@
<Compile Include="SamplePages\LinkedIn Service\LinkedInPage.xaml.cs">
<DependentUpon>LinkedInPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\Loading\LoadingPage.xaml.cs">
<DependentUpon>LoadingPage.xaml</DependentUpon>
</Compile>
<Compile Include="SamplePages\MasterDetailsView\MasterDetailsViewPage.xaml.cs">
<DependentUpon>MasterDetailsViewPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -632,6 +637,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="SamplePages\Loading\LoadingPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="SamplePages\MasterDetailsView\MasterDetailsViewPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.LoadingPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">

<Page.Resources>
<ResourceDictionary>
<DataTemplate x:Key="WaitListTemplate">
<StackPanel Orientation="Horizontal" Padding="12">
<ProgressRing IsActive="True" Margin="0,0,12,0" Foreground="{StaticResource Brush-Blue-01}" />
<TextBlock Text="Loading control with wait ring" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="ProgressBarTemplate">
<ProgressBar IsIndeterminate="True" Width="{Binding ElementName=PageName, Path=ActualWidth}"
Foreground="{StaticResource Brush-Grey-04}" />
</DataTemplate>
<DataTemplate x:Key="LogoTemplate">
<StackPanel Orientation="Horizontal" Padding="12">
<Image Source="../../Assets/ToolkitLogo.png" Height="50" Margin="0,0,12,0" />
<TextBlock Text="Loading control with logo" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>

<DataTemplate x:Key="PhotosTemplate">
<Grid Background="White" BorderBrush="Black" BorderThickness="1">
<Image Source="{Binding Thumbnail}"
Stretch="UniformToFill"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
</DataTemplate>
</ResourceDictionary>
</Page.Resources>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<ScrollViewer>
<StackPanel Margin="20">
<RichTextBlock Margin="0,10,0,0" Foreground="{StaticResource Brush-Grey-03}">
<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>
<Paragraph />
<Paragraph>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</Paragraph>
<Paragraph />
<Paragraph>Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id.</Paragraph>
<Paragraph />
<Paragraph>His audiam deserunt in, eum ubique voluptatibus te. In reque dicta usu. Ne rebum dissentiet eam, vim omnis deseruisse id. Ullum deleniti vituperata at quo, insolens complectitur te eos, ea pri dico munere propriae. Vel ferri facilis ut, qui paulo ridens praesent ad. Possim alterum qui cu. Accusamus consulatu ius te, cu decore soleat appareat usu.</Paragraph>
</RichTextBlock>

<controls:AdaptiveGridView
Margin="0,12,0,0"
x:Name="AdaptiveGridViewControl"
ItemHeight="200"
DesiredWidth="300"
SelectionMode="None"
IsItemClickEnabled="False"
ItemTemplate="{StaticResource PhotosTemplate}" />

</StackPanel>
</ScrollViewer>

<controls:Loading x:Name="LoadingControl" HorizontalContentAlignment="@[HorizontalContentAlignment:Enum:HorizontalAlignment.Center:Left.Right.Center.Stretch]"
VerticalContentAlignment="@[VerticalContentAlignment:Enum:VerticalAlignment.Center:Stretch.Center.Top.Bottom]"
Background="@[Background:Brush:CadetBlue]" Opacity="@[Opacity:DoubleSlider:0.75:0-1]">
<ContentControl x:Name="LoadingContentControl"/>
</controls:Loading>
</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<Page x:Name="PageName"
x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.LoadingPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">

<Page.Resources>
<ResourceDictionary>
<DataTemplate x:Key="WaitListTemplate">
<StackPanel Orientation="Horizontal" Padding="12">
<ProgressRing IsActive="True" Margin="0,0,12,0" Foreground="{StaticResource Brush-Blue-01}" />
<TextBlock Text="Loading control with wait ring" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="ProgressBarTemplate">
<ProgressBar IsIndeterminate="True" Width="{Binding ElementName=PageName, Path=ActualWidth}"
Foreground="{StaticResource Brush-Grey-04}" />
</DataTemplate>
<DataTemplate x:Key="LogoTemplate">
<StackPanel Orientation="Horizontal" Padding="12">
<Image Source="../../Assets/ToolkitLogo.png" Height="50" Margin="0,0,12,0" />
<TextBlock Text="Loading control with logo" VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>

<DataTemplate x:Key="PhotosTemplate">
<Grid Background="White" BorderBrush="Black" BorderThickness="1">
<Image Source="{Binding Thumbnail}"
Stretch="UniformToFill"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Grid>
</DataTemplate>
</ResourceDictionary>
</Page.Resources>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<ScrollViewer>
<StackPanel Margin="20">
<RichTextBlock Margin="0,10,0,0" Foreground="{StaticResource Brush-Grey-03}">
<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>
<Paragraph />
<Paragraph>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.</Paragraph>
<Paragraph />
<Paragraph>Expetenda tincidunt in sed, ex partem placerat sea, porro commodo ex eam. His putant aeterno interesset at. Usu ea mundi tincidunt, omnium virtute aliquando ius ex. Ea aperiri sententiae duo. Usu nullam dolorum quaestio ei, sit vidit facilisis ea. Per ne impedit iracundia neglegentur. Consetetur neglegentur eum ut, vis animal legimus inimicus id.</Paragraph>
<Paragraph />
<Paragraph>His audiam deserunt in, eum ubique voluptatibus te. In reque dicta usu. Ne rebum dissentiet eam, vim omnis deseruisse id. Ullum deleniti vituperata at quo, insolens complectitur te eos, ea pri dico munere propriae. Vel ferri facilis ut, qui paulo ridens praesent ad. Possim alterum qui cu. Accusamus consulatu ius te, cu decore soleat appareat usu.</Paragraph>
</RichTextBlock>

<controls:AdaptiveGridView
Margin="0,12,0,0"
x:Name="AdaptiveGridViewControl"
ItemHeight="200"
DesiredWidth="300"
SelectionMode="None"
IsItemClickEnabled="False"
ItemTemplate="{StaticResource PhotosTemplate}" />

</StackPanel>
</ScrollViewer>

<controls:Loading x:Name="LoadingControl"
HorizontalContentAlignment="{Binding HorizontalContentAlignment.Value}"
VerticalContentAlignment="{Binding VerticalContentAlignment.Value}"
Background="{Binding Background.Value}"
Opacity="{Binding Opacity.Value}">
<ContentControl x:Name="LoadingContentControl" />
</controls:Loading>
</Grid>
</Page>



Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using System.Threading.Tasks;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using Microsoft.Toolkit.Uwp.SampleApp.Models;
using Microsoft.Toolkit.Uwp.UI.Animations;

namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class LoadingPage
{
public LoadingPage()
{
InitializeComponent();
}

protected override async void OnNavigatedTo(NavigationEventArgs e)
{
var propertyDesc = e.Parameter as PropertyDescriptor;

if (propertyDesc != null)
{
DataContext = propertyDesc.Expando;
}

AdaptiveGridViewControl.ItemsSource = await new Data.PhotosDataSource().GetItemsAsync();

Shell.Current.RegisterNewCommand("Loading control with wait ring", async (sender, args) =>
{
LoadingContentControl.ContentTemplate = Resources["WaitListTemplate"] as DataTemplate;
await ShowLoadingDialogAsync();
});

Shell.Current.RegisterNewCommand("Loading control with progressbar", async (sender, args) =>
{
LoadingContentControl.ContentTemplate = Resources["ProgressBarTemplate"] as DataTemplate;
await ShowLoadingDialogAsync();
});

Shell.Current.RegisterNewCommand("Loading control with logo and bluring when it requested", async (sender, args) =>
{
LoadingContentControl.ContentTemplate = Resources["LogoTemplate"] as DataTemplate;
await LoadingContentControl.Blur(10, 1000, 0).StartAsync();
await ShowLoadingDialogAsync();
});

base.OnNavigatedTo(e);
}

private async Task ShowLoadingDialogAsync()
{
LoadingControl.IsLoading = true;
await Task.Delay(3000);
LoadingControl.IsLoading = false;
}
}
}
8 changes: 8 additions & 0 deletions Microsoft.Toolkit.Uwp.SampleApp/SamplePages/samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@
"Icon": "/SamplePages/DropShadowPanel/DropShadowPanel.png",
"BadgeUpdateVersionRequired": "/Assets/Badges/windows10_anniversary.png"
},
{
"Name": "Loading",
"Type": "LoadingPage",
"About": "LoadingControl helps to show content with animation to the user while the app is doing some calculation.",
"CodeUrl": "https://github.com/Microsoft/UWPCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.UI.Controls/Loading",
"XamlCodeFile": "LoadingCode.bind",
"Icon": "/SamplePages/Loading/Loading.png"
},
{
"Name": "TextBoxMask",
"Type": "TextBoxMaskPage",
Expand Down
45 changes: 45 additions & 0 deletions Microsoft.Toolkit.Uwp.UI.Controls/Loading/Loading.Properties.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace Microsoft.Toolkit.Uwp.UI.Controls
{
/// <summary>
/// Loading control allows to show an loading animation with some xaml in it.
/// </summary>
public partial class Loading
{
/// <summary>
/// Identifies the <see cref="IsLoading"/> dependency property.
/// </summary>
public static readonly DependencyProperty IsLoadingProperty = DependencyProperty.Register(
nameof(IsLoading), typeof(bool), typeof(Loading), new PropertyMetadata(default(bool), IsLoadingPropertyChanged));

/// <summary>
/// Gets or sets a value indicating whether the control is in the loading state.
/// </summary>
public bool IsLoading
{
get { return (bool)GetValue(IsLoadingProperty); }
set { SetValue(IsLoadingProperty, value); }
}

private static void IsLoadingPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var control = d as Loading;
control?.Update();
}
}
}
46 changes: 46 additions & 0 deletions Microsoft.Toolkit.Uwp.UI.Controls/Loading/Loading.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************

using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace Microsoft.Toolkit.Uwp.UI.Controls
{
/// <summary>
/// Loading control allows to show an loading animation with some xaml in it.
/// </summary>
[TemplateVisualState(Name = "LoadingIn", GroupName = "CommonStates")]
[TemplateVisualState(Name = "LoadingOut", GroupName = "CommonStates")]
public partial class Loading : ContentControl
{
/// <summary>
/// Initializes a new instance of the <see cref="Loading"/> class.
/// </summary>
public Loading()
{
DefaultStyleKey = typeof(Loading);
}

protected override void OnApplyTemplate()
{
base.OnApplyTemplate();

Update();
}

private void Update()
{
VisualStateManager.GoToState(this, IsLoading ? "LoadingIn" : "LoadingOut", true);
}
}
}
Loading