From 33628908248430882ed7ce22f8a49a09f64b01db Mon Sep 17 00:00:00 2001 From: michael-hawker <24302614+michael-hawker@users.noreply.github.com> Date: Wed, 16 Dec 2020 17:29:51 -0800 Subject: [PATCH 1/3] Creating Microsoft.Toolkit.Uwp.UI.Behaviors Removes ScrollHeader from the Controls Package Updates Sample pages to use Behaviors instead from new Behaviors package TODO/Broken: - Animation Behaviors Currently don't have a home (still in folder structure of Animations, most likely removed for new approach using Behaviors directly w/ new Animation System) - General Animation extensions removed (to be replaced with a new coordinated system) - Blur/Saturation Effect extensions don't have a home (to move to Media package?) - Sample App - Graph Control Samples (needs to be rebuilt with new Behaviors package) - ViewportBehavior Example (was using Blur Extension) - Re-apply Blur effect to the backgrounds in Shell.xaml as was using Behavior --- .../Microsoft.Toolkit.Uwp.SampleApp.csproj | 77 +------ .../Models/Sample.cs | 22 +- .../FadeHeader/FadeHeaderBehaviorPage.xaml | 10 +- .../FadeHeader/FadeHeaderBehaviorXaml.bind | 4 +- .../IconExtensions/IconExtensionsPage.xaml.cs | 4 - .../ImplicitAnimationsCode.bind | 16 +- .../LoginButton/LoginButtonPage.xaml | 12 +- .../SamplePages/OnDevice/OnDevicePage.xaml.cs | 4 - .../PeoplePicker/PeoplePickerPage.xaml | 8 +- .../PersonView/PersonViewPage.xaml | 4 +- .../ScrollHeader/ScrollHeaderCode.bind | 45 +++-- .../ScrollHeader/ScrollHeaderPage.xaml | 18 +- .../ScrollViewerExtensionsPage.xaml | 131 ++++++------ .../ScrollViewerExtensionsXaml.bind | 47 +++-- .../ViewportBehaviorPage.xaml.cs | 6 +- Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml | 157 +++++++++------ .../Custom/PivotHeaderItemUnderlineStyle.xaml | 173 ++++++++++------ ...Microsoft.Toolkit.Uwp.UI.Animations.csproj | 20 +- .../SurfaceLoader.cs | 190 ------------------ .../ApiInformationHelper.cs | 14 ++ .../BehaviorBase.cs | 0 .../Focus}/AutoFocusBehavior.cs | 0 .../Focus}/FocusBehavior.cs | 0 .../Headers}/FadeHeaderBehavior.cs | 4 +- .../Headers}/QuickReturnHeaderBehavior.cs | 3 +- .../Headers}/StickyHeaderBehavior.cs | 3 +- .../Microsoft.Toolkit.Uwp.UI.Behaviors.csproj | 31 +++ .../Microsoft.Toolkit.Uwp.UI.Behaviors.rd.xml | 5 + .../Viewport}/ViewportBehavior.cs | 0 .../Microsoft.Toolkit.Uwp.UI.Controls.csproj | 1 + .../ScrollHeader/ScrollHeader.cs | 96 --------- .../ScrollHeader/ScrollHeader.xaml | 16 -- .../ScrollHeader/ScrollHeaderMode.cs | 32 --- .../Themes/Generic.xaml | 1 - .../Microsoft.Toolkit.Uwp.UI.csproj | 10 +- Windows Community Toolkit.sln | 23 +++ 36 files changed, 466 insertions(+), 721 deletions(-) delete mode 100644 Microsoft.Toolkit.Uwp.UI.Animations/SurfaceLoader.cs create mode 100644 Microsoft.Toolkit.Uwp.UI.Behaviors/ApiInformationHelper.cs rename {Microsoft.Toolkit.Uwp.UI/Behaviors => Microsoft.Toolkit.Uwp.UI.Behaviors}/BehaviorBase.cs (100%) rename {Microsoft.Toolkit.Uwp.UI/Behaviors => Microsoft.Toolkit.Uwp.UI.Behaviors/Focus}/AutoFocusBehavior.cs (100%) rename {Microsoft.Toolkit.Uwp.UI/Behaviors => Microsoft.Toolkit.Uwp.UI.Behaviors/Focus}/FocusBehavior.cs (100%) rename {Microsoft.Toolkit.Uwp.UI.Animations/Behaviors => Microsoft.Toolkit.Uwp.UI.Behaviors/Headers}/FadeHeaderBehavior.cs (98%) rename {Microsoft.Toolkit.Uwp.UI.Animations/Behaviors => Microsoft.Toolkit.Uwp.UI.Behaviors/Headers}/QuickReturnHeaderBehavior.cs (99%) rename {Microsoft.Toolkit.Uwp.UI.Animations/Behaviors => Microsoft.Toolkit.Uwp.UI.Behaviors/Headers}/StickyHeaderBehavior.cs (98%) create mode 100644 Microsoft.Toolkit.Uwp.UI.Behaviors/Microsoft.Toolkit.Uwp.UI.Behaviors.csproj create mode 100644 Microsoft.Toolkit.Uwp.UI.Behaviors/Properties/Microsoft.Toolkit.Uwp.UI.Behaviors.rd.xml rename {Microsoft.Toolkit.Uwp.UI/Behaviors => Microsoft.Toolkit.Uwp.UI.Behaviors/Viewport}/ViewportBehavior.cs (100%) delete mode 100644 Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.cs delete mode 100644 Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.xaml delete mode 100644 Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeaderMode.cs diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj index c163498a562..8c9bb57abca 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj +++ b/Microsoft.Toolkit.Uwp.SampleApp/Microsoft.Toolkit.Uwp.SampleApp.csproj @@ -112,9 +112,6 @@ 10.1901.28001 - - 6.1.0-build.6 - 2.4.2 @@ -294,7 +291,6 @@ - @@ -303,7 +299,6 @@ - @@ -325,7 +320,6 @@ - @@ -336,7 +330,6 @@ - @@ -344,10 +337,7 @@ - - - @@ -380,11 +370,7 @@ - - - - @@ -396,13 +382,7 @@ - - - - - - @@ -422,8 +402,6 @@ - - Designer @@ -440,8 +418,6 @@ - - Designer @@ -832,9 +808,6 @@ BladePage.xaml - - BlurBehaviorPage.xaml - AlignmentGridPage.xaml @@ -844,9 +817,6 @@ MicrosoftTranslatorPage.xaml - - SaturationBehaviorPage.xaml - TileControlPage.xaml @@ -867,9 +837,6 @@ - - LightBehaviorPage.xaml - LinkedInPage.xaml @@ -915,12 +882,6 @@ TwitterPage.xaml - - OffsetBehaviorPage.xaml - - - FadeBehaviorPage.xaml - ImageExPage.xaml @@ -934,12 +895,6 @@ WeatherLiveTileAndToastPage.xaml - - RotateBehaviorPage.xaml - - - ScaleBehaviorPage.xaml - RadialGaugePage.xaml @@ -1305,10 +1260,6 @@ Designer MSBuild:Compile - - MSBuild:Compile - Designer - MSBuild:Compile Designer @@ -1325,10 +1276,6 @@ MSBuild:Compile Designer - - Designer - MSBuild:Compile - MSBuild:Compile Designer @@ -1357,10 +1304,6 @@ MSBuild:Compile Designer - - Designer - MSBuild:Compile - Designer MSBuild:Compile @@ -1393,14 +1336,6 @@ MSBuild:Compile Designer - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - Designer MSBuild:Compile @@ -1453,14 +1388,6 @@ MSBuild:Compile Designer - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - Designer MSBuild:Compile @@ -1531,6 +1458,10 @@ {1ae2cb5c-58a0-4f12-8e6f-2cd4aaadb34c} Microsoft.Toolkit.Uwp.Samples.BackgroundTasks + + {d4ff799d-0df2-495a-adc9-3bbc4aef8971} + Microsoft.Toolkit.Uwp.UI.Behaviors + {daeb9cec-c817-33b2-74b2-bc379380db72} Microsoft.Toolkit.Uwp.UI.Controls.DataGrid diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs b/Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs index 805261aa7ec..6bc44c71e22 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/Models/Sample.cs @@ -16,8 +16,6 @@ using System.Text.Json.Serialization; using System.Text.RegularExpressions; using System.Threading.Tasks; -using Microsoft.Toolkit.Graph.Converters; -using Microsoft.Toolkit.Graph.Providers; using Microsoft.Toolkit.Uwp.Helpers; using Microsoft.Toolkit.Uwp.Input.GazeInteraction; using Microsoft.Toolkit.Uwp.SampleApp.Models; @@ -658,16 +656,16 @@ private static Type LookForTypeByName(string typeName) } // Search in Microsoft.Toolkit.Graph.Controls - var graphControlsProxyType = typeof(UserToPersonConverter); - assembly = graphControlsProxyType.GetTypeInfo().Assembly; - - foreach (var typeInfo in assembly.ExportedTypes) - { - if (typeInfo.Name == typeName) - { - return typeInfo; - } - } + //var graphControlsProxyType = typeof(UserToPersonConverter); + //assembly = graphControlsProxyType.GetTypeInfo().Assembly; + + //foreach (var typeInfo in assembly.ExportedTypes) + //{ + // if (typeInfo.Name == typeName) + // { + // return typeInfo; + // } + //} // Search in Microsoft.Toolkit.Uwp.UI.Animations var animationsProxyType = EasingType.Default; diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader/FadeHeaderBehaviorPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader/FadeHeaderBehaviorPage.xaml index a2ae6567063..ce25561b9d0 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader/FadeHeaderBehaviorPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader/FadeHeaderBehaviorPage.xaml @@ -7,12 +7,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> - - - - - - - - + + \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader/FadeHeaderBehaviorXaml.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader/FadeHeaderBehaviorXaml.bind index 851181f5164..60ffa5965b2 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader/FadeHeaderBehaviorXaml.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/FadeHeader/FadeHeaderBehaviorXaml.bind @@ -3,7 +3,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:interactivity="using:Microsoft.Xaml.Interactivity" - xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Animations.Behaviors" + xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Behaviors" mc:Ignorable="d"> @@ -24,7 +24,7 @@ Margin="12" /> diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/IconExtensions/IconExtensionsPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/IconExtensions/IconExtensionsPage.xaml.cs index 0311ad04acf..35971fb6a53 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/IconExtensions/IconExtensionsPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/IconExtensions/IconExtensionsPage.xaml.cs @@ -2,10 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Linq; -using Microsoft.Toolkit.Uwp.UI.Animations.Behaviors; -using Microsoft.Toolkit.Uwp.UI.Extensions; -using Microsoft.Xaml.Interactivity; using Windows.UI.Xaml; namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsCode.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsCode.bind index 71ab3ffa96e..ca217f3cd13 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsCode.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Implicit Animations/ImplicitAnimationsCode.bind @@ -19,24 +19,24 @@ extensions:VisualExtensions.CenterPoint="50,50,0"> - - + + - + - - + + - + - + - + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LoginButton/LoginButtonPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LoginButton/LoginButtonPage.xaml index cd37f20d156..ca429d0df3f 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LoginButton/LoginButtonPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/LoginButton/LoginButtonPage.xaml @@ -1,19 +1,19 @@  - + - - + + - + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/OnDevice/OnDevicePage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/OnDevice/OnDevicePage.xaml.cs index 9943ccb283d..274c96025f0 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/OnDevice/OnDevicePage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/OnDevice/OnDevicePage.xaml.cs @@ -2,10 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Linq; -using Microsoft.Toolkit.Uwp.UI.Animations.Behaviors; -using Microsoft.Toolkit.Uwp.UI.Extensions; -using Microsoft.Xaml.Interactivity; using Windows.UI.Xaml; namespace Microsoft.Toolkit.Uwp.SampleApp.SamplePages diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PeoplePicker/PeoplePickerPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PeoplePicker/PeoplePickerPage.xaml index 829819c6c95..c4da0eaa5ae 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PeoplePicker/PeoplePickerPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PeoplePicker/PeoplePickerPage.xaml @@ -7,10 +7,12 @@ xmlns:wgt="using:Microsoft.Toolkit.Graph.Controls" mc:Ignorable="d"> - + - + - + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PersonView/PersonViewPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PersonView/PersonViewPage.xaml index 702efbf97d2..fc19d88e848 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PersonView/PersonViewPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/PersonView/PersonViewPage.xaml @@ -5,8 +5,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:wgt="using:Microsoft.Toolkit.Graph.Controls" mc:Ignorable="d"> - + - + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader/ScrollHeaderCode.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader/ScrollHeaderCode.bind index 8303522e746..9edcd2542b6 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader/ScrollHeaderCode.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader/ScrollHeaderCode.bind @@ -2,34 +2,37 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" xmlns:models="using:Microsoft.Toolkit.Uwp.SampleApp.Models" + xmlns:interactivity="using:Microsoft.Xaml.Interactivity" + xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Behaviors" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> + + + - - - - - - - - + + + + + + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader/ScrollHeaderPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader/ScrollHeaderPage.xaml index d95346f0b88..44a877fd63d 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader/ScrollHeaderPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollHeader/ScrollHeaderPage.xaml @@ -1,19 +1,15 @@  - - - - - - - - - - + + + + + + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions/ScrollViewerExtensionsPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions/ScrollViewerExtensionsPage.xaml index 08bf65c2e7c..d4da6b9a6da 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions/ScrollViewerExtensionsPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions/ScrollViewerExtensionsPage.xaml @@ -1,10 +1,12 @@ - @@ -14,47 +16,49 @@ + extensions:ScrollViewerExtensions.VerticalScrollBarMargin="{Binding MinHeight, ElementName=MyHeaderGrid, Converter={StaticResource DoubleTopThicknessConverter}}"> + + + - - - - - - - - + + + + + + - + + Grid.Column="0" + Width="100" + Height="100" + Margin="0,0,24,0" + Source="ms-appx:///Assets/ToolkitLogo.png" /> + VerticalAlignment="Center" + Text="{Binding Title}" + TextTrimming="CharacterEllipsis" /> @@ -66,45 +70,44 @@ - - + - - + HorizontalAlignment="Center" + VerticalAlignment="Center" + Orientation="Horizontal" + Spacing="4"> + + - - - - + + + + - + Fill="Crimson" + Points="0,0 0,60 60,60 60,0" + Stroke="DarkRed" /> \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions/ScrollViewerExtensionsXaml.bind b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions/ScrollViewerExtensionsXaml.bind index 555377bdebe..6b28c95e185 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions/ScrollViewerExtensionsXaml.bind +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ScrollViewerExtensions/ScrollViewerExtensionsXaml.bind @@ -5,6 +5,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:interactivity="using:Microsoft.Xaml.Interactivity" + xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Behaviors" mc:Ignorable="d"> @@ -15,29 +17,30 @@ + + + - - - - - - - - + + + + + + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs index eb09f531121..17a683842cb 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/ViewportBehavior/ViewportBehaviorPage.xaml.cs @@ -39,7 +39,7 @@ public void OnXamlRendered(FrameworkElement control) if (control.FindChildByName("EffectElement") is Image effectElement) { _effectElement = effectElement; - _effectElement.Blur(value: 10, duration: 0).Start(); + ////TODO: _effectElement.Blur(value: 10, duration: 0).Start(); } if (control.FindChildByName("EffectElementHost") is FrameworkElement effectElementHost) @@ -72,7 +72,7 @@ private async void EffectElementHost_EnteredViewport(object sender, EventArgs e) { AddLog("Entered viewport"); - await _effectElement.Blur(value: 0, duration: 1500).StartAsync(); + ////TODO: await _effectElement.Blur(value: 0, duration: 1500).StartAsync(); } private void EffectElementHost_EnteringViewport(object sender, EventArgs e) @@ -87,7 +87,7 @@ private async void EffectElementHost_ExitedViewport(object sender, EventArgs e) AddLog("Exited viewport"); _effectElement.Source = null; - await _effectElement.Blur(value: 8, duration: 0).StartAsync(); + ////TODO: await _effectElement.Blur(value: 8, duration: 0).StartAsync(); } private void EffectElementHost_ExitingViewport(object sender, EventArgs e) diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml b/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml index 7aa45fcdc86..fc16ce0693f 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/Shell.xaml @@ -1,15 +1,15 @@  + Style="{StaticResource ToolkitNavViewStyle}"> + QueryIcon="Find" + QuerySubmitted="SearchBox_QuerySubmitted" + TextChanged="SearchBox_TextChanged" /> - + - + Duration="0" />--> - + - + - + + ShadowOpacity="0.7" + Color="Black"> @@ -89,35 +93,47 @@ - + - + - - + + - - + + @@ -125,30 +141,30 @@ + Visibility="Collapsed"> - + ShadowOpacity="0.6" + Color="Black"> - + @@ -160,58 +176,81 @@ - - + Text="{Binding About}" + TextWrapping="Wrap" /> - + - - + + - - + + - - + + - - + + diff --git a/Microsoft.Toolkit.Uwp.SampleApp/Styles/Custom/PivotHeaderItemUnderlineStyle.xaml b/Microsoft.Toolkit.Uwp.SampleApp/Styles/Custom/PivotHeaderItemUnderlineStyle.xaml index 73231c861a7..7d7ad535788 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/Styles/Custom/PivotHeaderItemUnderlineStyle.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/Styles/Custom/PivotHeaderItemUnderlineStyle.xaml @@ -1,14 +1,17 @@ - - - + + + + + + - - + + - - + + - - + + @@ -43,71 +79,97 @@ + Storyboard.TargetProperty="X" + To="{ThemeResource PivotHeaderItemLockedTranslation}" + Duration="0" /> + Storyboard.TargetProperty="(UIElement.Opacity)" + To="0" + Duration="0" /> - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -121,25 +183,6 @@ - - - - - - diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Microsoft.Toolkit.Uwp.UI.Animations.csproj b/Microsoft.Toolkit.Uwp.UI.Animations/Microsoft.Toolkit.Uwp.UI.Animations.csproj index df6558d9426..f31624a8267 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Microsoft.Toolkit.Uwp.UI.Animations.csproj +++ b/Microsoft.Toolkit.Uwp.UI.Animations/Microsoft.Toolkit.Uwp.UI.Animations.csproj @@ -7,22 +7,34 @@ This library provides helpers and extensions on top of Windows Composition and XAML storyboards. It is part of the Windows Community Toolkit. Namespace: - - Behaviors: Blur, CompositionBehaviorBase, CompositionBehaviorBase, Fade, FadeHeaderBehavior, Light, Offset, QuickReturnHeaderBehavior, Rotate, Saturation, Scale, StickyHeaderBehavior. - CompositionAnimations: - Animations: AnimationBase, OffsetAnimation, OpacityAnimation, RotationAnimation, RotationInDegreesAnimation, ScalarAnimation, ScaleAnimation, TranslationAnimation, TypedAnimationBase, Vector2Animation, Vector3Animation, Vector4Animation - CompositionAnimations: ExpressionKeyFrame, KeyFrame, KeyFrameCollection, ScalarKeyFrame, TypedKeyFrame, Vector2KeyFrame, Vector3KeyFrame, Vector4KeyFrame - ConnectedAnimations: Connected, ConnectedAnimationHelper, ConnectedAnimationListProperty, ConnectedAnimationProperties - - Effects: AnimationEffect, Blur, Saturation - Expressions: ExpressionNodes, ExpressionValues, ReferenceNodes, CompositionExtensions, ExpressionFunctions, OperationType - AnimationExtensions: Blur, Fade, Light, Offset, Rotate, Saturation, Scale UWP Toolkit Windows Animations Composition Connected Implicit XAML + + + + + + + + + + + + + + + + - - diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/SurfaceLoader.cs b/Microsoft.Toolkit.Uwp.UI.Animations/SurfaceLoader.cs deleted file mode 100644 index 8610c13fb83..00000000000 --- a/Microsoft.Toolkit.Uwp.UI.Animations/SurfaceLoader.cs +++ /dev/null @@ -1,190 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading.Tasks; -using Microsoft.Graphics.Canvas; -using Microsoft.Graphics.Canvas.Text; -using Microsoft.Graphics.Canvas.UI.Composition; -using Windows.Foundation; -using Windows.Foundation.Metadata; -using Windows.Graphics.DirectX; -using Windows.UI; -using Windows.UI.Composition; - -namespace Microsoft.Toolkit.Uwp.UI.Animations -{ - /// - /// A delegate for load time effects. - /// - /// The bitmap. - /// The device. - /// The size target. - /// A CompositeDrawingSurface - public delegate CompositionDrawingSurface LoadTimeEffectHandler(CanvasBitmap bitmap, CompositionGraphicsDevice device, Size sizeTarget); - - /// - /// The SurfaceLoader is responsible to loading images into Composition Objects. - /// - [Deprecated("This class is deprecated, please use the SurfaceLoader class from the Microsoft.Toolkit.Uwp.UI.Media package.", DeprecationType.Deprecate, 6)] - public class SurfaceLoader - { - /// - /// A flag to store the initialized state. - /// - private static bool _intialized; - - /// - /// The compositor - /// - private static Compositor _compositor; - - /// - /// The canvas device - /// - private static CanvasDevice _canvasDevice; - - /// - /// The composition graphic device to determine which GPU is handling the request. - /// - private static CompositionGraphicsDevice _compositionDevice; - - /// - /// Initializes the specified compositor. - /// - /// The compositor. - public static void Initialize(Compositor compositor) - { - if (!_intialized) - { - _compositor = compositor; - _canvasDevice = new CanvasDevice(); - _compositionDevice = CanvasComposition.CreateCompositionGraphicsDevice(_compositor, _canvasDevice); - - _intialized = true; - } - } - - /// - /// Uninitializes this instance. - /// - public static void Uninitialize() - { - _compositor = null; - - if (_compositionDevice != null) - { - _compositionDevice.Dispose(); - _compositionDevice = null; - } - - if (_canvasDevice != null) - { - _canvasDevice.Dispose(); - _canvasDevice = null; - } - - _intialized = false; - } - - /// - /// Gets a value indicating whether this instance is initialized. - /// - /// - /// true if this instance is initialized; otherwise, false. - /// - public static bool IsInitialized - { - get - { - return _intialized; - } - } - - /// - /// Loads an image from the URI. - /// - /// The URI. - /// - public static async Task LoadFromUri(Uri uri) - { - return await LoadFromUri(uri, Size.Empty); - } - - /// - /// Loads an image from URI with a specified size. - /// - /// The URI. - /// The size target. - /// - public static async Task LoadFromUri(Uri uri, Size sizeTarget) - { - CanvasBitmap bitmap = await CanvasBitmap.LoadAsync(_canvasDevice, uri); - Size sizeSource = bitmap.Size; - - if (sizeTarget.IsEmpty) - { - sizeTarget = sizeSource; - } - - CompositionDrawingSurface surface = _compositionDevice.CreateDrawingSurface( - sizeTarget, - DirectXPixelFormat.B8G8R8A8UIntNormalized, - DirectXAlphaMode.Premultiplied); - - using (var ds = CanvasComposition.CreateDrawingSession(surface)) - { - ds.Clear(Color.FromArgb(0, 0, 0, 0)); - ds.DrawImage(bitmap, new Rect(0, 0, sizeTarget.Width, sizeTarget.Height), new Rect(0, 0, sizeSource.Width, sizeSource.Height)); - } - - return surface; - } - - /// - /// Loads the text on to a . - /// - /// The text. - /// The size target. - /// The text format. - /// Color of the text. - /// Color of the bg. - /// - public static CompositionDrawingSurface LoadText(string text, Size sizeTarget, CanvasTextFormat textFormat, Color textColor, Color bgColor) - { - CompositionDrawingSurface surface = _compositionDevice.CreateDrawingSurface( - sizeTarget, - DirectXPixelFormat.B8G8R8A8UIntNormalized, - DirectXAlphaMode.Premultiplied); - - using (var ds = CanvasComposition.CreateDrawingSession(surface)) - { - ds.Clear(bgColor); - ds.DrawText(text, new Rect(0, 0, sizeTarget.Width, sizeTarget.Height), textColor, textFormat); - } - - return surface; - } - - /// - /// Loads an image from URI, with a specified size. - /// - /// The URI. - /// The size target. - /// The load effect handler callback. - /// - public static async Task LoadFromUri(Uri uri, Size sizeTarget, LoadTimeEffectHandler loadEffectHandler) - { - if (loadEffectHandler != null) - { - var bitmap = await CanvasBitmap.LoadAsync(_canvasDevice, uri); - return loadEffectHandler(bitmap, _compositionDevice, sizeTarget); - } - else - { - return await LoadFromUri(uri, sizeTarget); - } - } - } -} \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Behaviors/ApiInformationHelper.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/ApiInformationHelper.cs new file mode 100644 index 00000000000..a7875948b3b --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Behaviors/ApiInformationHelper.cs @@ -0,0 +1,14 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Windows.Foundation.Metadata; + +namespace Microsoft.Toolkit.Uwp.UI.Behaviors +{ + internal class ApiInformationHelper + { + // 1903 - 18362 + public static bool IsXamlRootAvailable { get; } = ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "XamlRoot"); + } +} \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI/Behaviors/BehaviorBase.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/BehaviorBase.cs similarity index 100% rename from Microsoft.Toolkit.Uwp.UI/Behaviors/BehaviorBase.cs rename to Microsoft.Toolkit.Uwp.UI.Behaviors/BehaviorBase.cs diff --git a/Microsoft.Toolkit.Uwp.UI/Behaviors/AutoFocusBehavior.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/Focus/AutoFocusBehavior.cs similarity index 100% rename from Microsoft.Toolkit.Uwp.UI/Behaviors/AutoFocusBehavior.cs rename to Microsoft.Toolkit.Uwp.UI.Behaviors/Focus/AutoFocusBehavior.cs diff --git a/Microsoft.Toolkit.Uwp.UI/Behaviors/FocusBehavior.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/Focus/FocusBehavior.cs similarity index 100% rename from Microsoft.Toolkit.Uwp.UI/Behaviors/FocusBehavior.cs rename to Microsoft.Toolkit.Uwp.UI.Behaviors/Focus/FocusBehavior.cs diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/FadeHeaderBehavior.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/FadeHeaderBehavior.cs similarity index 98% rename from Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/FadeHeaderBehavior.cs rename to Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/FadeHeaderBehavior.cs index c965f783473..231a354515f 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/FadeHeaderBehavior.cs +++ b/Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/FadeHeaderBehavior.cs @@ -3,13 +3,13 @@ // See the LICENSE file in the project root for more information. using Microsoft.Toolkit.Uwp.UI.Animations.Expressions; -using Microsoft.Toolkit.Uwp.UI.Behaviors; using Microsoft.Toolkit.Uwp.UI.Extensions; +using Windows.UI.Composition; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Hosting; -namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors +namespace Microsoft.Toolkit.Uwp.UI.Behaviors { /// /// Performs an fade animation on a ListView or GridView Header using composition. diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/QuickReturnHeaderBehavior.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/QuickReturnHeaderBehavior.cs similarity index 99% rename from Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/QuickReturnHeaderBehavior.cs rename to Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/QuickReturnHeaderBehavior.cs index fe86fd75bbb..ffe9e518cd5 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/QuickReturnHeaderBehavior.cs +++ b/Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/QuickReturnHeaderBehavior.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Microsoft.Toolkit.Uwp.UI.Animations.Expressions; -using Microsoft.Toolkit.Uwp.UI.Behaviors; using Microsoft.Toolkit.Uwp.UI.Extensions; using Windows.Foundation; using Windows.UI.Composition; @@ -12,7 +11,7 @@ using Windows.UI.Xaml.Hosting; using Windows.UI.Xaml.Input; -namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors +namespace Microsoft.Toolkit.Uwp.UI.Behaviors { /// /// Performs an animation on a ListView or GridView Header to make it quick return using composition. diff --git a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/StickyHeaderBehavior.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/StickyHeaderBehavior.cs similarity index 98% rename from Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/StickyHeaderBehavior.cs rename to Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/StickyHeaderBehavior.cs index ec322bf6eb3..5ca0fbf764e 100644 --- a/Microsoft.Toolkit.Uwp.UI.Animations/Behaviors/StickyHeaderBehavior.cs +++ b/Microsoft.Toolkit.Uwp.UI.Behaviors/Headers/StickyHeaderBehavior.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Microsoft.Toolkit.Uwp.UI.Animations.Expressions; -using Microsoft.Toolkit.Uwp.UI.Behaviors; using Microsoft.Toolkit.Uwp.UI.Extensions; using Windows.Foundation; using Windows.UI.Composition; @@ -13,7 +12,7 @@ using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; -namespace Microsoft.Toolkit.Uwp.UI.Animations.Behaviors +namespace Microsoft.Toolkit.Uwp.UI.Behaviors { /// /// Performs an animation on a ListView or GridView Header to make it sticky using composition. diff --git a/Microsoft.Toolkit.Uwp.UI.Behaviors/Microsoft.Toolkit.Uwp.UI.Behaviors.csproj b/Microsoft.Toolkit.Uwp.UI.Behaviors/Microsoft.Toolkit.Uwp.UI.Behaviors.csproj new file mode 100644 index 00000000000..045cbbc0cec --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Behaviors/Microsoft.Toolkit.Uwp.UI.Behaviors.csproj @@ -0,0 +1,31 @@ + + + + uap10.0.17763 + 8.0 + Windows Community Toolkit UI Behaviors + + This library provides UI behaviors built on the XAML behaviors SDK. It is part of the Windows Community Toolkit. + + Behaviors: + - BehaviorBase: Helper for building Behaviors + - AutoFocusBehevior: Sets focus to the associated control. + - FocusBehavior: Sets focus to a specified control. + - ViewportBehavior: Listening for element to enter or exit the ScrollViewer viewport + - FadeHeaderBehavior, QuickReturnHeaderBehavior, StickyHeaderBehavior: Helpers for ListViewBase Header Behavior + + UWP Toolkit Windows UI Behaviors XAML + + true + + + + + + + + + + + + diff --git a/Microsoft.Toolkit.Uwp.UI.Behaviors/Properties/Microsoft.Toolkit.Uwp.UI.Behaviors.rd.xml b/Microsoft.Toolkit.Uwp.UI.Behaviors/Properties/Microsoft.Toolkit.Uwp.UI.Behaviors.rd.xml new file mode 100644 index 00000000000..2a652962f91 --- /dev/null +++ b/Microsoft.Toolkit.Uwp.UI.Behaviors/Properties/Microsoft.Toolkit.Uwp.UI.Behaviors.rd.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Microsoft.Toolkit.Uwp.UI/Behaviors/ViewportBehavior.cs b/Microsoft.Toolkit.Uwp.UI.Behaviors/Viewport/ViewportBehavior.cs similarity index 100% rename from Microsoft.Toolkit.Uwp.UI/Behaviors/ViewportBehavior.cs rename to Microsoft.Toolkit.Uwp.UI.Behaviors/Viewport/ViewportBehavior.cs diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj b/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj index bf18c15c898..26ff92e907a 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj @@ -47,6 +47,7 @@ + diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.cs b/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.cs deleted file mode 100644 index 21c44fcf9b0..00000000000 --- a/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Toolkit.Uwp.UI.Animations.Behaviors; -using Microsoft.Toolkit.Uwp.UI.Extensions; -using Microsoft.Xaml.Interactivity; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; - -namespace Microsoft.Toolkit.Uwp.UI.Controls -{ - /// - /// Scroll header control to be used with ListViews or GridViews - /// - public class ScrollHeader : ContentControl - { - /// - /// Initializes a new instance of the class. - /// - public ScrollHeader() - { - DefaultStyleKey = typeof(ScrollHeader); - HorizontalContentAlignment = HorizontalAlignment.Stretch; - } - - /// - /// Identifies the property. - /// - public static readonly DependencyProperty ModeProperty = - DependencyProperty.Register(nameof(Mode), typeof(ScrollHeaderMode), typeof(ScrollHeader), new PropertyMetadata(ScrollHeaderMode.None, OnModeChanged)); - - /// - /// Gets or sets a value indicating whether the current mode. - /// Default is none. - /// - public ScrollHeaderMode Mode - { - get { return (ScrollHeaderMode)GetValue(ModeProperty); } - set { SetValue(ModeProperty, value); } - } - - /// - /// Invoked whenever application code or internal processes (such as a rebuilding layout pass) call . - /// - protected override void OnApplyTemplate() - { - UpdateScrollHeaderBehavior(); - } - - private static void OnModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - (d as ScrollHeader)?.UpdateScrollHeaderBehavior(); - } - - private static void OnTargetChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - (d as ScrollHeader)?.OnApplyTemplate(); - } - - private void UpdateScrollHeaderBehavior() - { - var targetListViewBase = this.FindAscendant(); - - if (targetListViewBase == null) - { - return; - } - - // Remove previous behaviors - foreach (var behavior in Interaction.GetBehaviors(targetListViewBase)) - { - if (behavior is FadeHeaderBehavior || behavior is QuickReturnHeaderBehavior || behavior is StickyHeaderBehavior) - { - Interaction.GetBehaviors(targetListViewBase).Remove(behavior); - } - } - - switch (Mode) - { - case ScrollHeaderMode.None: - break; - case ScrollHeaderMode.QuickReturn: - Interaction.GetBehaviors(targetListViewBase).Add(new QuickReturnHeaderBehavior()); - break; - case ScrollHeaderMode.Sticky: - Interaction.GetBehaviors(targetListViewBase).Add(new StickyHeaderBehavior()); - break; - case ScrollHeaderMode.Fade: - Interaction.GetBehaviors(targetListViewBase).Add(new FadeHeaderBehavior()); - break; - } - } - } -} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.xaml deleted file mode 100644 index 2521843c6f5..00000000000 --- a/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeader.xaml +++ /dev/null @@ -1,16 +0,0 @@ - - - diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeaderMode.cs b/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeaderMode.cs deleted file mode 100644 index 5774585a90d..00000000000 --- a/Microsoft.Toolkit.Uwp.UI.Controls/ScrollHeader/ScrollHeaderMode.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Toolkit.Uwp.UI.Controls -{ - /// - /// Define mode available for - /// - public enum ScrollHeaderMode - { - /// - /// No change. This is the default value. - /// - None, - - /// - /// Enable quick return mode. - /// - QuickReturn, - - /// - /// Enable sticky mode. - /// - Sticky, - - /// - /// Enable fade mode. - /// - Fade - } -} diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml index 6422f8690d2..a6c650d3a4b 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Themes/Generic.xaml @@ -27,7 +27,6 @@ - diff --git a/Microsoft.Toolkit.Uwp.UI/Microsoft.Toolkit.Uwp.UI.csproj b/Microsoft.Toolkit.Uwp.UI/Microsoft.Toolkit.Uwp.UI.csproj index 99767ff0f0c..a9387db46e3 100644 --- a/Microsoft.Toolkit.Uwp.UI/Microsoft.Toolkit.Uwp.UI.csproj +++ b/Microsoft.Toolkit.Uwp.UI/Microsoft.Toolkit.Uwp.UI.csproj @@ -9,10 +9,6 @@ AdvancedCollectionView: It's a collection view implementation that support filtering, sorting and incremental loading. It's meant to be used in a viewmodel. - Behaviors: - - BehaviorBase: Helper for building Behaviors - - ViewportBehavior: Listening for element to enter or exit the ScrollViewer viewport - CacheBase: Provides methods and tools to cache files in a folder. Converters: Commonly used converters that allow the data to be modified as it passes through the binding engine. @@ -47,11 +43,7 @@ true - - - - - + diff --git a/Windows Community Toolkit.sln b/Windows Community Toolkit.sln index 17df1370cd3..9f57b24e708 100644 --- a/Windows Community Toolkit.sln +++ b/Windows Community Toolkit.sln @@ -135,6 +135,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UITests.Tests.TAEF", "UITes EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "UITests.Tests.Shared", "UITests\UITests.Tests.Shared\UITests.Tests.Shared.shproj", "{1D8B0260-5C17-41DA-9C38-1E37441B3925}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Toolkit.Uwp.UI.Behaviors", "Microsoft.Toolkit.Uwp.UI.Behaviors\Microsoft.Toolkit.Uwp.UI.Behaviors.csproj", "{D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution UITests\UITests.Tests.Shared\UITests.Tests.Shared.projitems*{05c83067-fa46-45e2-bec4-edee84ad18d0}*SharedItemsImports = 4 @@ -956,6 +958,26 @@ Global {C8182EF0-77FB-4B43-A588-C71748A309C7}.Release|x64.Build.0 = Release|Any CPU {C8182EF0-77FB-4B43-A588-C71748A309C7}.Release|x86.ActiveCfg = Release|Any CPU {C8182EF0-77FB-4B43-A588-C71748A309C7}.Release|x86.Build.0 = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|ARM.ActiveCfg = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|ARM.Build.0 = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|ARM64.Build.0 = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|x64.ActiveCfg = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|x64.Build.0 = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|x86.ActiveCfg = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Debug|x86.Build.0 = Debug|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|Any CPU.Build.0 = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|ARM.ActiveCfg = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|ARM.Build.0 = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|ARM64.ActiveCfg = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|ARM64.Build.0 = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|x64.ActiveCfg = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|x64.Build.0 = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|x86.ActiveCfg = Release|Any CPU + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -997,6 +1019,7 @@ Global {5F720475-E263-4A5A-8C88-2B805B45B5BC} = {6FAA1CFE-3368-4FD2-9DBD-F4700F69174C} {C8182EF0-77FB-4B43-A588-C71748A309C7} = {6FAA1CFE-3368-4FD2-9DBD-F4700F69174C} {1D8B0260-5C17-41DA-9C38-1E37441B3925} = {6FAA1CFE-3368-4FD2-9DBD-F4700F69174C} + {D4FF799D-0DF2-495A-ADC9-3BBC4AEF8971} = {F1AFFFA7-28FE-4770-BA48-10D76F3E59BC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {5403B0C4-F244-4F73-A35C-FE664D0F4345} From 9f77bb90aff09ee5924572f2720237d42b36809a Mon Sep 17 00:00:00 2001 From: michael-hawker <24302614+michael-hawker@users.noreply.github.com> Date: Thu, 17 Dec 2020 13:36:00 -0800 Subject: [PATCH 2/3] Removed ScrollHeader from project description --- .../Microsoft.Toolkit.Uwp.UI.Controls.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj b/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj index 26ff92e907a..692244e59f6 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Microsoft.Toolkit.Uwp.UI.Controls.csproj @@ -31,7 +31,6 @@ - RangeSelector: "Double slider" control for range values. - RemoteDevicePicker: Remote Device Picker Control for Project Rome. - RotatorTile: Rotates through a set of items one-by-one like a live-tile. - - ScrollHeader: A UI control that works as a ListView or GridView header control with quick return, sticky, and fade behavior. - StaggeredPanel: Layout of items in a column approach where an item will be added to whichever column has used the least amount of space. - TextToolbar: A Toolbar for Editing Text attached to a RichEditBox. It can format RTF, Markdown, or use a Custom Formatter. - TileControl: A ContentControl that show an image repeated many times. From ddb66d293bf3502a5be93d6857840e56282fe6f5 Mon Sep 17 00:00:00 2001 From: michael-hawker <24302614+michael-hawker@users.noreply.github.com> Date: Fri, 18 Dec 2020 16:19:41 -0800 Subject: [PATCH 3/3] Add new Behaviors project to Smoke Tests Also refactored list to make it easier to read. --- .../MainPage.xaml | 35 +++++++++++ .../MainPage.xaml.cs | 60 +++++++++++++++++++ .../Microsoft.Toolkit.Uwp.UI/MainPage.xaml | 30 +++------- .../Microsoft.Toolkit.Uwp.UI/MainPage.xaml.cs | 39 +----------- SmokeTests/SmokeTests.proj | 22 ++++++- 5 files changed, 127 insertions(+), 59 deletions(-) create mode 100644 SmokeTests/Microsoft.Toolkit.Uwp.UI.Behaviors/MainPage.xaml create mode 100644 SmokeTests/Microsoft.Toolkit.Uwp.UI.Behaviors/MainPage.xaml.cs diff --git a/SmokeTests/Microsoft.Toolkit.Uwp.UI.Behaviors/MainPage.xaml b/SmokeTests/Microsoft.Toolkit.Uwp.UI.Behaviors/MainPage.xaml new file mode 100644 index 00000000000..cef24c59c88 --- /dev/null +++ b/SmokeTests/Microsoft.Toolkit.Uwp.UI.Behaviors/MainPage.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + diff --git a/SmokeTests/Microsoft.Toolkit.Uwp.UI.Behaviors/MainPage.xaml.cs b/SmokeTests/Microsoft.Toolkit.Uwp.UI.Behaviors/MainPage.xaml.cs new file mode 100644 index 00000000000..d1fe446c34f --- /dev/null +++ b/SmokeTests/Microsoft.Toolkit.Uwp.UI.Behaviors/MainPage.xaml.cs @@ -0,0 +1,60 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Diagnostics; +using System.Linq; +using Microsoft.Toolkit.Uwp.UI.Behaviors; +using Microsoft.Xaml.Interactivity; +using Windows.UI.Xaml.Media.Imaging; + +namespace SmokeTest +{ + public sealed partial class MainPage + { + public MainPage() + { + InitializeComponent(); + + Loaded += this.MainPage_Loaded; + } + + private void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) + { + var behaviors = Interaction.GetBehaviors(EffectElementHost); + var viewportBehavior = behaviors.OfType().FirstOrDefault(); + if (viewportBehavior != null) + { + viewportBehavior.EnteredViewport += EffectElementHost_EnteredViewport; + viewportBehavior.EnteringViewport += EffectElementHost_EnteringViewport; + viewportBehavior.ExitedViewport += EffectElementHost_ExitedViewport; + viewportBehavior.ExitingViewport += EffectElementHost_ExitingViewport; + } + } + + private void EffectElementHost_EnteredViewport(object sender, EventArgs e) + { + Debug.WriteLine("Entered viewport"); + } + + private void EffectElementHost_EnteringViewport(object sender, EventArgs e) + { + Debug.WriteLine("Entering viewport"); + + EffectElement.Source = new BitmapImage(new Uri("ms-appx:///Assets/ToolkitLogo.png")); + } + + private void EffectElementHost_ExitedViewport(object sender, EventArgs e) + { + Debug.WriteLine("Exited viewport"); + + EffectElement.Source = null; + } + + private void EffectElementHost_ExitingViewport(object sender, EventArgs e) + { + Debug.WriteLine("Exiting viewport"); + } + } +} diff --git a/SmokeTests/Microsoft.Toolkit.Uwp.UI/MainPage.xaml b/SmokeTests/Microsoft.Toolkit.Uwp.UI/MainPage.xaml index cef24c59c88..f6361b121cc 100644 --- a/SmokeTests/Microsoft.Toolkit.Uwp.UI/MainPage.xaml +++ b/SmokeTests/Microsoft.Toolkit.Uwp.UI/MainPage.xaml @@ -3,33 +3,19 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:SmokeTest" - xmlns:interactivity="using:Microsoft.Xaml.Interactivity" - xmlns:behaviors="using:Microsoft.Toolkit.Uwp.UI.Behaviors" + xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> - - - - - - - - - - - + diff --git a/SmokeTests/Microsoft.Toolkit.Uwp.UI/MainPage.xaml.cs b/SmokeTests/Microsoft.Toolkit.Uwp.UI/MainPage.xaml.cs index d1fe446c34f..8acca918716 100644 --- a/SmokeTests/Microsoft.Toolkit.Uwp.UI/MainPage.xaml.cs +++ b/SmokeTests/Microsoft.Toolkit.Uwp.UI/MainPage.xaml.cs @@ -5,9 +5,8 @@ using System; using System.Diagnostics; using System.Linq; -using Microsoft.Toolkit.Uwp.UI.Behaviors; -using Microsoft.Xaml.Interactivity; -using Windows.UI.Xaml.Media.Imaging; +using Microsoft.Toolkit.Uwp.UI.Extensions; +using Windows.UI.Xaml.Controls; namespace SmokeTest { @@ -22,39 +21,7 @@ public MainPage() private void MainPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { - var behaviors = Interaction.GetBehaviors(EffectElementHost); - var viewportBehavior = behaviors.OfType().FirstOrDefault(); - if (viewportBehavior != null) - { - viewportBehavior.EnteredViewport += EffectElementHost_EnteredViewport; - viewportBehavior.EnteringViewport += EffectElementHost_EnteringViewport; - viewportBehavior.ExitedViewport += EffectElementHost_ExitedViewport; - viewportBehavior.ExitingViewport += EffectElementHost_ExitingViewport; - } - } - - private void EffectElementHost_EnteredViewport(object sender, EventArgs e) - { - Debug.WriteLine("Entered viewport"); - } - - private void EffectElementHost_EnteringViewport(object sender, EventArgs e) - { - Debug.WriteLine("Entering viewport"); - - EffectElement.Source = new BitmapImage(new Uri("ms-appx:///Assets/ToolkitLogo.png")); - } - - private void EffectElementHost_ExitedViewport(object sender, EventArgs e) - { - Debug.WriteLine("Exited viewport"); - - EffectElement.Source = null; - } - - private void EffectElementHost_ExitingViewport(object sender, EventArgs e) - { - Debug.WriteLine("Exiting viewport"); + var border = this.FindDescendant(); } } } diff --git a/SmokeTests/SmokeTests.proj b/SmokeTests/SmokeTests.proj index 18b9aee3a8b..ae2228c01c2 100644 --- a/SmokeTests/SmokeTests.proj +++ b/SmokeTests/SmokeTests.proj @@ -4,7 +4,27 @@ x86 Release - UWPBaseline;Microsoft.Toolkit;Microsoft.Toolkit.HighPerformance;Microsoft.Toolkit.Parsers;Microsoft.Toolkit.Mvvm;Microsoft.Toolkit.Services;Microsoft.Toolkit.Uwp;Microsoft.Toolkit.Uwp.Connectivity;Microsoft.Toolkit.Uwp.DeveloperTools;Microsoft.Toolkit.Uwp.Input.GazeInteraction;Microsoft.Toolkit.Uwp.Notifications;Microsoft.Toolkit.Uwp.UI;Microsoft.Toolkit.Uwp.UI.Animations;Microsoft.Toolkit.Uwp.UI.Controls;Microsoft.Toolkit.Uwp.UI.Controls.DataGrid;Microsoft.Toolkit.Uwp.UI.Controls.Layout;Microsoft.Toolkit.Uwp.UI.Media;Microsoft.Toolkit.Uwp.UI.Controls.Markdown + + UWPBaseline; + Microsoft.Toolkit; + Microsoft.Toolkit.HighPerformance; + Microsoft.Toolkit.Mvvm; + Microsoft.Toolkit.Parsers; + Microsoft.Toolkit.Services; + Microsoft.Toolkit.Uwp; + Microsoft.Toolkit.Uwp.Connectivity; + Microsoft.Toolkit.Uwp.DeveloperTools; + Microsoft.Toolkit.Uwp.Input.GazeInteraction; + Microsoft.Toolkit.Uwp.Notifications; + Microsoft.Toolkit.Uwp.UI; + Microsoft.Toolkit.Uwp.UI.Animations; + Microsoft.Toolkit.Uwp.UI.Behaviors; + Microsoft.Toolkit.Uwp.UI.Controls; + Microsoft.Toolkit.Uwp.UI.Controls.DataGrid; + Microsoft.Toolkit.Uwp.UI.Controls.Layout; + Microsoft.Toolkit.Uwp.UI.Controls.Markdown; + Microsoft.Toolkit.Uwp.UI.Media; +