Skip to content

Commit 0c6640d

Browse files
authored
Merge pull request #892 from Microsoft/dev
v1.3.0
2 parents 4e16315 + 5a3e37e commit 0c6640d

File tree

496 files changed

+37424
-5061
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

496 files changed

+37424
-5061
lines changed

Microsoft.Toolkit.Uwp.SampleApp/App.xaml

Lines changed: 110 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -5,126 +5,126 @@
55
xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp"
66
RequestedTheme="Light">
77

8-
<Application.Resources>
8+
<Application.Resources>
99

10-
<!-- Colors -->
11-
<Color x:Key="Grey-01">#FF333333</Color>
12-
<Color x:Key="Grey-02">#FF444444</Color>
13-
<Color x:Key="Grey-03">#FF555555</Color>
14-
<Color x:Key="Grey-04">#FFDDDDDD</Color>
15-
<Color x:Key="Grey-05">#FFF0F0F0</Color>
16-
<Color x:Key="White">#FFFFFFFF</Color>
10+
<!-- Colors -->
11+
<Color x:Key="Grey-01">#FF333333</Color>
12+
<Color x:Key="Grey-02">#FF444444</Color>
13+
<Color x:Key="Grey-03">#FF555555</Color>
14+
<Color x:Key="Grey-04">#FFDDDDDD</Color>
15+
<Color x:Key="Grey-05">#FFF0F0F0</Color>
16+
<Color x:Key="White">#FFFFFFFF</Color>
1717

18-
<Color x:Key="Blue-01">#FF0078D7</Color>
18+
<Color x:Key="Blue-01">#FF0078D7</Color>
1919

20-
<!-- Brushes -->
21-
<SolidColorBrush x:Key="Brush-Grey-01"
22-
Color="{StaticResource Grey-01}" />
23-
<SolidColorBrush x:Key="Brush-Grey-02"
24-
Color="{StaticResource Grey-02}" />
25-
<SolidColorBrush x:Key="Brush-Grey-03"
26-
Color="{StaticResource Grey-03}" />
27-
<SolidColorBrush x:Key="Brush-Grey-04"
28-
Color="{StaticResource Grey-04}" />
29-
<SolidColorBrush x:Key="Brush-Grey-05"
30-
Color="{StaticResource Grey-05}" />
31-
<SolidColorBrush x:Key="Brush-White"
32-
Color="{StaticResource White}" />
20+
<!-- Brushes -->
21+
<SolidColorBrush x:Key="Brush-Grey-01"
22+
Color="{StaticResource Grey-01}" />
23+
<SolidColorBrush x:Key="Brush-Grey-02"
24+
Color="{StaticResource Grey-02}" />
25+
<SolidColorBrush x:Key="Brush-Grey-03"
26+
Color="{StaticResource Grey-03}" />
27+
<SolidColorBrush x:Key="Brush-Grey-04"
28+
Color="{StaticResource Grey-04}" />
29+
<SolidColorBrush x:Key="Brush-Grey-05"
30+
Color="{StaticResource Grey-05}" />
31+
<SolidColorBrush x:Key="Brush-White"
32+
Color="{StaticResource White}" />
3333

34-
<SolidColorBrush x:Key="Brush-Blue-01"
35-
Color="{StaticResource Blue-01}" />
34+
<SolidColorBrush x:Key="Brush-Blue-01"
35+
Color="{StaticResource Blue-01}" />
3636

37-
<!-- Styles -->
37+
<!-- Styles -->
3838

39-
<Style TargetType="TextBlock">
40-
<Setter Property="Foreground" Value="{StaticResource Brush-Grey-01}" />
41-
</Style>
39+
<Style TargetType="TextBlock">
40+
<Setter Property="Foreground" Value="{StaticResource Brush-Grey-01}" />
41+
</Style>
4242

43-
<Style TargetType="Button">
44-
<Setter Property="Foreground" Value="{StaticResource Brush-Grey-01}" />
45-
</Style>
43+
<Style TargetType="Button">
44+
<Setter Property="Foreground" Value="{StaticResource Brush-Grey-01}" />
45+
</Style>
4646

4747

48-
<Style TargetType="controls:CodeRenderer">
49-
<Setter Property="Template">
50-
<Setter.Value>
51-
<ControlTemplate TargetType="controls:CodeRenderer">
48+
<Style TargetType="controls:CodeRenderer">
49+
<Setter Property="Template">
50+
<Setter.Value>
51+
<ControlTemplate TargetType="controls:CodeRenderer">
52+
<Grid>
53+
<Grid.RowDefinitions>
54+
<RowDefinition />
55+
<RowDefinition Height="Auto" />
56+
</Grid.RowDefinitions>
57+
<Grid x:Name="Container"
58+
Grid.RowSpan="2"
59+
Opacity="0" />
60+
<ProgressRing Name="progress"
61+
Grid.Row="0"
62+
Width="100"
63+
Height="100"
64+
HorizontalAlignment="Center"
65+
VerticalAlignment="Center"
66+
Foreground="{TemplateBinding Foreground}"
67+
IsActive="True" />
68+
<WebView Name="webView"
69+
Grid.Row="0"
70+
Visibility="Collapsed" />
71+
<Button x:Name="PrintButton"
72+
Grid.Row="1"
73+
Margin="5"
74+
HorizontalAlignment="Center"
75+
Content="Print" />
76+
</Grid>
77+
</ControlTemplate>
78+
</Setter.Value>
79+
</Setter>
80+
</Style>
81+
82+
<Style x:Key="TooltipFlyoutPresenterStyle"
83+
TargetType="FlyoutPresenter">
84+
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
85+
<Setter Property="VerticalContentAlignment" Value="Stretch" />
86+
<Setter Property="IsTabStop" Value="False" />
87+
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" />
88+
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundChromeHighBrush}" />
89+
<Setter Property="BorderThickness" Value="{ThemeResource FlyoutBorderThemeThickness}" />
90+
<Setter Property="Padding" Value="0" />
91+
<Setter Property="MinWidth" Value="{ThemeResource FlyoutThemeMinWidth}" />
92+
<Setter Property="MaxWidth" Value="{ThemeResource FlyoutThemeMaxHeight}" />
93+
<Setter Property="MinHeight" Value="{ThemeResource FlyoutThemeMinHeight}" />
94+
<Setter Property="MaxHeight" Value="{ThemeResource FlyoutThemeMaxHeight}" />
95+
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
96+
<Setter Property="Template">
97+
<Setter.Value>
98+
<ControlTemplate TargetType="FlyoutPresenter">
99+
<Border Margin="5"
100+
Background="{TemplateBinding Background}"
101+
BorderBrush="{TemplateBinding BorderBrush}"
102+
BorderThickness="{TemplateBinding BorderThickness}">
103+
<ScrollViewer x:Name="ScrollViewer"
104+
AutomationProperties.AccessibilityView="Raw"
105+
HorizontalScrollBarVisibility="Disabled"
106+
HorizontalScrollMode="Disabled"
107+
VerticalScrollBarVisibility="Auto"
108+
VerticalScrollMode="Auto"
109+
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
110+
<ContentPresenter Margin="{TemplateBinding Padding}"
111+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
112+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
113+
Content="{TemplateBinding Content}"
114+
ContentTemplate="{TemplateBinding ContentTemplate}"
115+
ContentTransitions="{TemplateBinding ContentTransitions}" />
116+
</ScrollViewer>
117+
</Border>
118+
</ControlTemplate>
119+
</Setter.Value>
120+
</Setter>
121+
</Style>
122+
<DataTemplate x:Key="PivotHeaderTemplate">
52123
<Grid>
53-
<Grid.RowDefinitions>
54-
<RowDefinition />
55-
<RowDefinition Height="Auto" />
56-
</Grid.RowDefinitions>
57-
<Grid x:Name="Container"
58-
Grid.RowSpan="2"
59-
Opacity="0" />
60-
<ProgressRing Name="progress"
61-
Grid.Row="0"
62-
Width="100"
63-
Height="100"
64-
HorizontalAlignment="Center"
65-
VerticalAlignment="Center"
66-
Foreground="{TemplateBinding Foreground}"
67-
IsActive="True" />
68-
<WebView Name="webView"
69-
Grid.Row="0"
70-
Visibility="Collapsed" />
71-
<Button x:Name="PrintButton"
72-
Grid.Row="1"
73-
Margin="5"
74-
HorizontalAlignment="Center"
75-
Content="Print" />
124+
<TextBlock FontSize="14"
125+
Text="{Binding}" />
76126
</Grid>
77-
</ControlTemplate>
78-
</Setter.Value>
79-
</Setter>
80-
</Style>
81-
82-
<Style x:Key="TooltipFlyoutPresenterStyle"
83-
TargetType="FlyoutPresenter">
84-
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
85-
<Setter Property="VerticalContentAlignment" Value="Stretch" />
86-
<Setter Property="IsTabStop" Value="False" />
87-
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundChromeMediumLowBrush}" />
88-
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundChromeHighBrush}" />
89-
<Setter Property="BorderThickness" Value="{ThemeResource FlyoutBorderThemeThickness}" />
90-
<Setter Property="Padding" Value="0" />
91-
<Setter Property="MinWidth" Value="{ThemeResource FlyoutThemeMinWidth}" />
92-
<Setter Property="MaxWidth" Value="{ThemeResource FlyoutThemeMaxHeight}" />
93-
<Setter Property="MinHeight" Value="{ThemeResource FlyoutThemeMinHeight}" />
94-
<Setter Property="MaxHeight" Value="{ThemeResource FlyoutThemeMaxHeight}" />
95-
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
96-
<Setter Property="Template">
97-
<Setter.Value>
98-
<ControlTemplate TargetType="FlyoutPresenter">
99-
<Border Margin="5"
100-
Background="{TemplateBinding Background}"
101-
BorderBrush="{TemplateBinding BorderBrush}"
102-
BorderThickness="{TemplateBinding BorderThickness}">
103-
<ScrollViewer x:Name="ScrollViewer"
104-
AutomationProperties.AccessibilityView="Raw"
105-
HorizontalScrollBarVisibility="Disabled"
106-
HorizontalScrollMode="Disabled"
107-
VerticalScrollBarVisibility="Auto"
108-
VerticalScrollMode="Auto"
109-
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
110-
<ContentPresenter Margin="{TemplateBinding Padding}"
111-
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
112-
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
113-
Content="{TemplateBinding Content}"
114-
ContentTemplate="{TemplateBinding ContentTemplate}"
115-
ContentTransitions="{TemplateBinding ContentTransitions}" />
116-
</ScrollViewer>
117-
</Border>
118-
</ControlTemplate>
119-
</Setter.Value>
120-
</Setter>
121-
</Style>
122-
<DataTemplate x:Key="PivotHeaderTemplate">
123-
<Grid>
124-
<TextBlock FontSize="14"
125-
Text="{Binding}" />
126-
</Grid>
127-
</DataTemplate>
128-
</Application.Resources>
127+
</DataTemplate>
128+
</Application.Resources>
129129

130130
</Application>

Microsoft.Toolkit.Uwp.SampleApp/App.xaml.cs

Lines changed: 55 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
using Windows.ApplicationModel.Activation;
1717
using Windows.Foundation.Metadata;
1818
using Windows.Graphics.Display;
19+
using Windows.System.Profile;
1920
using Windows.UI;
2021
using Windows.UI.ViewManagement;
2122
using Windows.UI.Xaml;
@@ -40,6 +41,29 @@ public App()
4041
Suspending += OnSuspending;
4142
}
4243

44+
protected override async void OnActivated(IActivatedEventArgs args)
45+
{
46+
await RunAppInitialization(null);
47+
48+
if (args.Kind == ActivationKind.Protocol)
49+
{
50+
try
51+
{
52+
// Launching via protocol link
53+
var parser = DeepLinkParser.Create(args);
54+
var targetSample = await Sample.FindAsync(parser.Root, parser["sample"]);
55+
if (targetSample != null)
56+
{
57+
Shell.Current?.NavigateToSample(targetSample);
58+
}
59+
}
60+
catch (Exception ex)
61+
{
62+
System.Diagnostics.Debug.WriteLine($"Error processing protocol launch: {ex.ToString()}");
63+
}
64+
}
65+
}
66+
4367
/// <summary>
4468
/// Invoked when the application is launched normally by the end user. Other entry points
4569
/// will be used such as when the application is launched to open a specific file.
@@ -52,6 +76,21 @@ protected override async void OnLaunched(LaunchActivatedEventArgs e)
5276
return;
5377
}
5478

79+
if (e.PreviousExecutionState != ApplicationExecutionState.Running
80+
&& e.PreviousExecutionState != ApplicationExecutionState.Suspended)
81+
{
82+
await RunAppInitialization(e?.Arguments);
83+
}
84+
}
85+
86+
private async System.Threading.Tasks.Task RunAppInitialization(string launchParameters)
87+
{
88+
// Go fullscreen on Xbox
89+
if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Xbox")
90+
{
91+
ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
92+
}
93+
5594
// Initialize the constant for the app display name, used for tile and toast previews
5695
if (Constants.ApplicationDisplayName == null)
5796
{
@@ -88,38 +127,30 @@ protected override async void OnLaunched(LaunchActivatedEventArgs e)
88127

89128
rootFrame.NavigationFailed += OnNavigationFailed;
90129

91-
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
92-
{
93-
// TODO: Load state from previously suspended application
94-
}
95-
96130
// Place the frame in the current Window
97131
Window.Current.Content = rootFrame;
98132
}
99133

100-
if (e.PrelaunchActivated == false)
134+
if (rootFrame.Content == null)
101135
{
102-
if (rootFrame.Content == null)
103-
{
104-
// When the navigation stack isn't restored navigate to the first page,
105-
// configuring the new page by passing required information as a navigation
106-
// parameter
107-
rootFrame.Navigate(typeof(Shell), e.Arguments);
108-
}
109-
110-
// Status bar
111-
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar") &&
112-
ApiInformation.IsMethodPresent("Windows.UI.ViewManagement.StatusBar", nameof(StatusBar.HideAsync)))
113-
{
114-
StatusBar statusBar = StatusBar.GetForCurrentView();
136+
// When the navigation stack isn't restored navigate to the first page,
137+
// configuring the new page by passing required information as a navigation
138+
// parameter
139+
rootFrame.Navigate(typeof(Shell), launchParameters);
140+
}
115141

116-
// Hide the status bar
117-
await statusBar.HideAsync();
118-
}
142+
// Status bar
143+
if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar") &&
144+
ApiInformation.IsMethodPresent("Windows.UI.ViewManagement.StatusBar", nameof(StatusBar.HideAsync)))
145+
{
146+
StatusBar statusBar = StatusBar.GetForCurrentView();
119147

120-
// Ensure the current window is active
121-
Window.Current.Activate();
148+
// Hide the status bar
149+
await statusBar.HideAsync();
122150
}
151+
152+
// Ensure the current window is active
153+
Window.Current.Activate();
123154
}
124155

125156
/// <summary>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// ******************************************************************
2+
// Copyright (c) Microsoft. All rights reserved.
3+
// This code is licensed under the MIT License (MIT).
4+
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
5+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
7+
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
8+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
9+
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
10+
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
11+
// ******************************************************************
12+
13+
using System;
14+
using Windows.UI.Xaml.Data;
15+
16+
namespace Microsoft.Toolkit.Uwp.SampleApp.Common
17+
{
18+
internal class BoolStringConverter : IValueConverter
19+
{
20+
public object Convert(object value, Type targetType, object parameter, string language)
21+
{
22+
return value.ToString();
23+
}
24+
25+
public object ConvertBack(object value, Type targetType, object parameter, string language)
26+
{
27+
return bool.Parse(value.ToString());
28+
}
29+
}
30+
}

Microsoft.Toolkit.Uwp.SampleApp/Controls/PropertyControl.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
DataContextChanged="PropertyControl_OnDataContextChanged"
1010
mc:Ignorable="d">
1111

12-
<StackPanel x:Name="RootPanel"
13-
Padding="15,20,15,20"
14-
Background="{StaticResource AppBarBackgroundThemeBrush}" />
12+
<StackPanel x:Name="RootPanel"
13+
Padding="15,20,15,20"
14+
Background="{StaticResource AppBarBackgroundThemeBrush}" />
1515
</UserControl>

0 commit comments

Comments
 (0)