diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index b31c75dde..965bd9046 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -4,8 +4,8 @@ variables:
PreviewNumber: $[counter(variables['CurrentSemanticVersionBase'], 1001)]
CurrentSemanticVersion: '$(CurrentSemanticVersionBase)-preview$(PreviewNumber)'
NugetPackageVersion: '$(CurrentSemanticVersion)'
- MONO_VERSION: 6_4_0
- XCODE_VERSION: 11.4
+ #MONO_VERSION: 6_4_0
+ #XCODE_VERSION: 11.4
NETCORE_VERSION: '3.1.x'
NETCORE_TEST_VERSION: '3.1.x'
RunPoliCheck: 'false'
@@ -153,11 +153,12 @@ jobs:
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
displayName: Set NuGet Version to Tag Number
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
+ # 16feb21 jfversluis: let's not pin this anymore and use latest
# make sure to select the correct Xamarin and mono
- - bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
- displayName: Switch to the latest Xamarin SDK
- - bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
- displayName: Switch to the latest Xcode
+ #- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
+ # displayName: Switch to the latest Xamarin SDK
+ #- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
+ # displayName: Switch to the latest Xcode
# restore, build and pack the packages
- task: UseDotNet@2
displayName: 'Use .Net Core sdk'
diff --git a/samples/XCT.Sample/Pages/AboutPage.xaml.cs b/samples/XCT.Sample/Pages/AboutPage.xaml.cs
index b4973351f..2c1826452 100644
--- a/samples/XCT.Sample/Pages/AboutPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/AboutPage.xaml.cs
@@ -1,4 +1,5 @@
using System;
+using Xamarin.CommunityToolkit.Sample.ViewModels;
namespace Xamarin.CommunityToolkit.Sample.Pages
{
diff --git a/samples/XCT.Sample/Pages/Behaviors/EmailValidationBehaviorPage.xaml b/samples/XCT.Sample/Pages/Behaviors/EmailValidationBehaviorPage.xaml
index e9d055e70..f9fef55cd 100644
--- a/samples/XCT.Sample/Pages/Behaviors/EmailValidationBehaviorPage.xaml
+++ b/samples/XCT.Sample/Pages/Behaviors/EmailValidationBehaviorPage.xaml
@@ -15,11 +15,21 @@
Spacing="50"
VerticalOptions="CenterAndExpand">
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/samples/XCT.Sample/Pages/Behaviors/ImpliedOrderGridBehaviorPage.xaml.cs b/samples/XCT.Sample/Pages/Behaviors/ImpliedOrderGridBehaviorPage.xaml.cs
index 6c1af281b..e671d3a1d 100644
--- a/samples/XCT.Sample/Pages/Behaviors/ImpliedOrderGridBehaviorPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Behaviors/ImpliedOrderGridBehaviorPage.xaml.cs
@@ -1,11 +1,9 @@
using System;
using System.Linq;
using Xamarin.Forms;
-using Xamarin.Forms.Xaml;
namespace Xamarin.CommunityToolkit.Sample.Pages.Behaviors
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ImpliedOrderGridBehaviorPage
{
public ImpliedOrderGridBehaviorPage() => InitializeComponent();
diff --git a/samples/XCT.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml.cs b/samples/XCT.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml.cs
index 51767df6e..857afffc0 100644
--- a/samples/XCT.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Behaviors/MaxLengthReachedBehaviorPage.xaml.cs
@@ -1,9 +1,7 @@
using Xamarin.CommunityToolkit.Behaviors;
-using Xamarin.Forms.Xaml;
namespace Xamarin.CommunityToolkit.Sample.Pages.Behaviors
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MaxLengthReachedBehaviorPage : BasePage
{
public MaxLengthReachedBehaviorPage()
diff --git a/samples/XCT.Sample/Pages/Behaviors/RequiredStringValidationBehaviorPage.xaml.cs b/samples/XCT.Sample/Pages/Behaviors/RequiredStringValidationBehaviorPage.xaml.cs
index 4bc8c0016..ad6f186f0 100644
--- a/samples/XCT.Sample/Pages/Behaviors/RequiredStringValidationBehaviorPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Behaviors/RequiredStringValidationBehaviorPage.xaml.cs
@@ -1,8 +1,5 @@
-using Xamarin.Forms.Xaml;
-
-namespace Xamarin.CommunityToolkit.Sample.Pages.Behaviors
+namespace Xamarin.CommunityToolkit.Sample.Pages.Behaviors
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class RequiredStringValidationBehaviorPage : BasePage
{
public RequiredStringValidationBehaviorPage()
diff --git a/samples/XCT.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml.cs b/samples/XCT.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml.cs
index bc3b31262..066560f7d 100644
--- a/samples/XCT.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Behaviors/UserStoppedTypingBehaviorPage.xaml.cs
@@ -1,8 +1,5 @@
-using Xamarin.Forms.Xaml;
-
-namespace Xamarin.CommunityToolkit.Sample.Pages.Behaviors
+namespace Xamarin.CommunityToolkit.Sample.Pages.Behaviors
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class UserStoppedTypingBehaviorPage : BasePage
{
public UserStoppedTypingBehaviorPage() => InitializeComponent();
diff --git a/samples/XCT.Sample/Pages/Converters/DateTimeOffsetConverterPage.xaml.cs b/samples/XCT.Sample/Pages/Converters/DateTimeOffsetConverterPage.xaml.cs
index 3e2984d5f..22654798d 100644
--- a/samples/XCT.Sample/Pages/Converters/DateTimeOffsetConverterPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Converters/DateTimeOffsetConverterPage.xaml.cs
@@ -1,8 +1,5 @@
-using Xamarin.Forms.Xaml;
-
-namespace Xamarin.CommunityToolkit.Sample.Pages.Converters
+namespace Xamarin.CommunityToolkit.Sample.Pages.Converters
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class DateTimeOffsetConverterPage : BasePage
{
public DateTimeOffsetConverterPage()
diff --git a/samples/XCT.Sample/Pages/Effects/EffectsGalleryPage.xaml.cs b/samples/XCT.Sample/Pages/Effects/EffectsGalleryPage.xaml.cs
index e63a98bc9..001353ba9 100644
--- a/samples/XCT.Sample/Pages/Effects/EffectsGalleryPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Effects/EffectsGalleryPage.xaml.cs
@@ -1,8 +1,5 @@
-using Xamarin.Forms.Xaml;
-
-namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
+namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class EffectsGalleryPage
{
public EffectsGalleryPage() => InitializeComponent();
diff --git a/samples/XCT.Sample/Pages/Effects/IconTintColorEffectPage.xaml.cs b/samples/XCT.Sample/Pages/Effects/IconTintColorEffectPage.xaml.cs
index e344a9c0b..d3fab6c14 100644
--- a/samples/XCT.Sample/Pages/Effects/IconTintColorEffectPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Effects/IconTintColorEffectPage.xaml.cs
@@ -1,8 +1,5 @@
-using Xamarin.Forms.Xaml;
-
-namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
+namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class IconTintColorEffectPage : BasePage
{
public IconTintColorEffectPage()
diff --git a/samples/XCT.Sample/Pages/Effects/RemoveBorderEffectPage.xaml.cs b/samples/XCT.Sample/Pages/Effects/RemoveBorderEffectPage.xaml.cs
index 5d109b590..54873b20e 100644
--- a/samples/XCT.Sample/Pages/Effects/RemoveBorderEffectPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Effects/RemoveBorderEffectPage.xaml.cs
@@ -1,12 +1,5 @@
-using System;
-using System.Collections.Generic;
-
-using Xamarin.Forms;
-using Xamarin.Forms.Xaml;
-
-namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
+namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class RemoveBorderEffectPage
{
public RemoveBorderEffectPage() => InitializeComponent();
diff --git a/samples/XCT.Sample/Pages/Effects/SafeAreaEffectPage.xaml.cs b/samples/XCT.Sample/Pages/Effects/SafeAreaEffectPage.xaml.cs
index 8fa159feb..8227d5564 100644
--- a/samples/XCT.Sample/Pages/Effects/SafeAreaEffectPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Effects/SafeAreaEffectPage.xaml.cs
@@ -1,9 +1,7 @@
using Xamarin.CommunityToolkit.Effects;
-using Xamarin.Forms.Xaml;
namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SafeAreaEffectPage
{
public SafeAreaEffectPage() => InitializeComponent();
diff --git a/samples/XCT.Sample/Pages/Effects/SelectAllTextEffectPage.xaml.cs b/samples/XCT.Sample/Pages/Effects/SelectAllTextEffectPage.xaml.cs
index f37276384..76a7e2628 100644
--- a/samples/XCT.Sample/Pages/Effects/SelectAllTextEffectPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Effects/SelectAllTextEffectPage.xaml.cs
@@ -1,12 +1,5 @@
-using System;
-using System.Collections.Generic;
-
-using Xamarin.Forms;
-using Xamarin.Forms.Xaml;
-
-namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
+namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SelectAllTextEffectPage
{
public SelectAllTextEffectPage() => InitializeComponent();
diff --git a/samples/XCT.Sample/Pages/Effects/TouchEffectPage.xaml.cs b/samples/XCT.Sample/Pages/Effects/TouchEffectPage.xaml.cs
index 466cfedcb..67253a5a1 100644
--- a/samples/XCT.Sample/Pages/Effects/TouchEffectPage.xaml.cs
+++ b/samples/XCT.Sample/Pages/Effects/TouchEffectPage.xaml.cs
@@ -1,10 +1,10 @@
using System.Windows.Input;
using Xamarin.CommunityToolkit.ObjectModel;
using Xamarin.Forms.Xaml;
+using Xamarin.Forms;
namespace Xamarin.CommunityToolkit.Sample.Pages.Effects
{
- [XamlCompilation(XamlCompilationOptions.Compile)]
public partial class TouchEffectPage
{
public TouchEffectPage()
diff --git a/samples/XCT.Sample/Pages/TestCases/TouchEffectCollectionViewPage.xaml b/samples/XCT.Sample/Pages/TestCases/TouchEffectCollectionViewPage.xaml
new file mode 100644
index 000000000..08c5fcc4b
--- /dev/null
+++ b/samples/XCT.Sample/Pages/TestCases/TouchEffectCollectionViewPage.xaml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+ One
+ Two
+ Three
+ Four
+ Five
+ Six
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/XCT.Sample/Pages/TestCases/TouchEffectCollectionViewPage.xaml.cs b/samples/XCT.Sample/Pages/TestCases/TouchEffectCollectionViewPage.xaml.cs
new file mode 100644
index 000000000..ada32eb11
--- /dev/null
+++ b/samples/XCT.Sample/Pages/TestCases/TouchEffectCollectionViewPage.xaml.cs
@@ -0,0 +1,19 @@
+
+using System.Windows.Input;
+using Xamarin.Forms;
+
+namespace Xamarin.CommunityToolkit.Sample.Pages.TestCases
+{
+ public partial class TouchEffectCollectionViewPage
+ {
+ ICommand longPressCommand;
+
+ public TouchEffectCollectionViewPage()
+ => InitializeComponent();
+
+ public ICommand LongPressCommand => longPressCommand ??= new Command(() =>
+ {
+ this.DisplayAlert("Long Press", null, "OK");
+ });
+ }
+}
diff --git a/samples/XCT.Sample/Pages/Views/SideMenuViewPage.xaml b/samples/XCT.Sample/Pages/Views/SideMenuViewPage.xaml
index 8e46bf770..ae62efc38 100644
--- a/samples/XCT.Sample/Pages/Views/SideMenuViewPage.xaml
+++ b/samples/XCT.Sample/Pages/Views/SideMenuViewPage.xaml
@@ -16,29 +16,32 @@
-
+
+
-
+
-
+
+
+
+
+ xct:SideMenuView.MenuWidthPercentage=".5"
+ BackgroundColor="Orange"/>
+ xct:SideMenuView.MenuWidthPercentage=".3"
+ BackgroundColor="LightGreen" />
diff --git a/samples/XCT.Sample/ViewModels/TestCases/TestCasesGalleryViewModel.cs b/samples/XCT.Sample/ViewModels/TestCases/TestCasesGalleryViewModel.cs
index 9e894109c..8ff86fc02 100644
--- a/samples/XCT.Sample/ViewModels/TestCases/TestCasesGalleryViewModel.cs
+++ b/samples/XCT.Sample/ViewModels/TestCases/TestCasesGalleryViewModel.cs
@@ -13,6 +13,11 @@ public class TestCasesGalleryViewModel : BaseGalleryViewModel
"TouchEffect + Button",
"TouchEffect must automatically invoke button'c command execution."),
+ new SectionModel(
+ typeof(TouchEffectCollectionViewPage),
+ "TouchEffect + CollectionView",
+ "Using TouchEffect's LongPress should allow still use items selection."),
+
new SectionModel(
typeof(MediaElementSourcePage),
"MediaElement with Source as string",
diff --git a/samples/XCT.Sample/ViewModels/Views/ViewsGalleryViewModel.cs b/samples/XCT.Sample/ViewModels/Views/ViewsGalleryViewModel.cs
index 9a95a3bc8..72caebe65 100644
--- a/samples/XCT.Sample/ViewModels/Views/ViewsGalleryViewModel.cs
+++ b/samples/XCT.Sample/ViewModels/Views/ViewsGalleryViewModel.cs
@@ -12,7 +12,7 @@ public class ViewsGalleryViewModel : BaseGalleryViewModel
"The AvatarView represents a user's name by using the initials and a generated background color"),
new SectionModel(typeof(BadgeViewPage), "BadgeView",
- "View used to used to notify users notifications, or status of something"),
+ "View used to notify users notifications, or status of something"),
new SectionModel(typeof(CameraViewPage), "CameraView",
"The CameraView allows you to show a live preview from the camera. You can take pictures, record videos and much more!"),
@@ -54,4 +54,4 @@ public class ViewsGalleryViewModel : BaseGalleryViewModel
"The popup control renders native popups from the shared code. This page demonstrates a variety of different techniques for displaying native popups.")
};
}
-}
\ No newline at end of file
+}
diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit.UnitTests/ObjectModel/ICommandTests/AsyncCommandTests/AsyncCommand_Tests.cs b/src/CommunityToolkit/Xamarin.CommunityToolkit.UnitTests/ObjectModel/ICommandTests/AsyncCommandTests/AsyncCommand_Tests.cs
index f2bb18211..63cbe4e0c 100644
--- a/src/CommunityToolkit/Xamarin.CommunityToolkit.UnitTests/ObjectModel/ICommandTests/AsyncCommandTests/AsyncCommand_Tests.cs
+++ b/src/CommunityToolkit/Xamarin.CommunityToolkit.UnitTests/ObjectModel/ICommandTests/AsyncCommandTests/AsyncCommand_Tests.cs
@@ -162,7 +162,7 @@ public void AsyncCommand_NoParameter_NoCanExecute_Test()
}
[Fact]
- public void AsyncCommand_RaiseCanExecuteChanged_Test()
+ public void AsyncCommand_RaiseCanExecuteChanged_MainThreadCreation_MainThreadExecution_Test()
{
// Arrange
var canCommandExecute = false;
@@ -193,9 +193,117 @@ public void AsyncCommand_RaiseCanExecuteChanged_Test()
}
[Fact]
- public void AsyncCommand_ChangeCanExecute_Test()
+ public Task AsyncCommand_RaiseCanExecuteChanged_BackgroundThreadCreation_BackgroundThreadExecution_Test() => Task.Run(async () =>
{
// Arrange
+ await Task.Delay(100).ConfigureAwait(false);
+
+ var canCommandExecute = false;
+ var didCanExecuteChangeFire = false;
+
+ var command = new AsyncCommand(NoParameterTask, commandCanExecute);
+ command.CanExecuteChanged += handleCanExecuteChanged;
+
+ bool commandCanExecute(object parameter) => canCommandExecute;
+
+ Assert.False(command.CanExecute(null));
+
+ // Act
+ canCommandExecute = true;
+
+ // Assert
+ Assert.True(command.CanExecute(null));
+ Assert.False(didCanExecuteChangeFire);
+
+ // Act
+ command.RaiseCanExecuteChanged();
+
+ // Assert
+ Assert.True(didCanExecuteChangeFire);
+ Assert.True(command.CanExecute(null));
+
+ void handleCanExecuteChanged(object sender, EventArgs e) => didCanExecuteChangeFire = true;
+ });
+
+ [Fact]
+ public async Task AsyncCommand_RaiseCanExecuteChanged_MainThreadCreation_BackgroundThreadExecution_Test()
+ {
+ // Arrange
+
+ var canCommandExecute = false;
+ var didCanExecuteChangeFire = false;
+
+ var command = new AsyncCommand(NoParameterTask, commandCanExecute);
+ command.CanExecuteChanged += handleCanExecuteChanged;
+
+ bool commandCanExecute(object parameter) => canCommandExecute;
+
+ Assert.False(command.CanExecute(null));
+
+ // Act
+ canCommandExecute = true;
+
+ // Assert
+ Assert.True(command.CanExecute(null));
+ Assert.False(didCanExecuteChangeFire);
+
+ // Act
+ await Task.Run(async () =>
+ {
+ await Task.Delay(100).ConfigureAwait(false);
+ command.RaiseCanExecuteChanged();
+
+ // Assert
+ Assert.True(didCanExecuteChangeFire);
+ Assert.True(command.CanExecute(null));
+ });
+
+ void handleCanExecuteChanged(object sender, EventArgs e) => didCanExecuteChangeFire = true;
+ }
+
+ [Fact]
+ public async Task AsyncCommand_RaiseCanExecuteChanged_BackgroundThreadCreation_MainThreadExecution_Test()
+ {
+ // Arrange
+ AsyncCommand command = null;
+ var didCanExecuteChangeFire = false;
+ var canCommandExecute = false;
+
+ await Task.Run(async () =>
+ {
+ await Task.Delay(100).ConfigureAwait(false);
+
+ command = new AsyncCommand(NoParameterTask, commandCanExecute);
+ command.CanExecuteChanged += handleCanExecuteChanged;
+
+ bool commandCanExecute(object parameter) => canCommandExecute;
+
+ Assert.False(command.CanExecute(null));
+
+ // Act
+ canCommandExecute = true;
+
+ // Assert
+ Assert.True(command.CanExecute(null));
+ Assert.False(didCanExecuteChangeFire);
+ }).ConfigureAwait(true);
+
+ // Act
+ command.RaiseCanExecuteChanged();
+
+ // Assert
+ Assert.True(didCanExecuteChangeFire);
+ Assert.True(command.CanExecute(null));
+
+ void handleCanExecuteChanged(object sender, EventArgs e) => didCanExecuteChangeFire = true;
+ }
+
+ [Fact]
+ public async Task AsyncCommand_ChangeCanExecute_Test()
+ {
+ // Arrange
+ var canExecuteChangedTCS = new TaskCompletionSource