Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TouchBehavior #1673

Merged
merged 112 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
6dae154
init
pictos Oct 2, 2022
3ef6241
code style
pictos Oct 2, 2022
c267f02
android bits
pictos Oct 2, 2022
ca56252
code style
pictos Oct 19, 2022
15d2ba9
dumb sample to test
pictos Oct 20, 2022
77615a0
added a11y and initialization
pictos Oct 20, 2022
609e995
code style
pictos Nov 5, 2022
e437c1c
improved sample
pictos Dec 30, 2022
85444fe
code style
pictos Dec 30, 2022
104344c
protect against NRE
pictos Dec 30, 2022
38f88e1
windows implementation
pictos Dec 30, 2022
574bba7
code style
pictos Mar 3, 2023
8e1a10a
Added comments to all public methods to enable builds without errors
kphillpotts Jul 4, 2023
a9f93e5
Missed some docs required for building
kphillpotts Jul 8, 2023
194a039
Touch effect maui (#1326)
christianrr Aug 10, 2023
c9efb8b
Bringing touch-effect up to date with main (#1383)
kphillpotts Sep 4, 2023
b6a45c8
Added MacOS and brought across the sample page style from XCT
kphillpotts Sep 5, 2023
2ee8e51
Added TouchBehavior Unit Tests
kphillpotts Oct 4, 2023
20e186c
Fixed issue with hover
kphillpotts Oct 26, 2023
d53315a
Fix Rebase Issues
Axemasta Feb 1, 2024
1ae959b
Manual fixes for rebase collisions
Axemasta Feb 27, 2024
a272913
Moved sample page to gallery
Axemasta Feb 27, 2024
5927843
Fixed behavior binding
Axemasta Feb 27, 2024
7270ed5
Fixed binding in sample
Axemasta Feb 28, 2024
2e34217
Added input transparency test case
Axemasta Feb 28, 2024
2f7e6ef
Fix issue with input transparency
Axemasta Feb 28, 2024
55dda78
Fixed Parent Child Taps
Axemasta Feb 28, 2024
6e2cf6d
Fixed Hover
Axemasta Mar 4, 2024
06a2281
Fixed Ripple View Positioning
Axemasta Mar 5, 2024
d8ba3c2
Code styling
Axemasta Mar 6, 2024
200b074
Dotnet format
Axemasta Mar 6, 2024
d61e3fd
Replaced Console with Trace
Axemasta Mar 6, 2024
50c19e1
Update GestureManager.cs
brminnick Mar 6, 2024
a6eb17c
Code review changes
Axemasta Mar 6, 2024
fe117a5
Code Review
brminnick Mar 7, 2024
ed3f03a
Remove duplicate `ColorTo` extension
brminnick Mar 7, 2024
6b4b0c5
Fix Windows
Axemasta Mar 10, 2024
046ab4c
Fixed unit tests
Axemasta Mar 10, 2024
e79eddd
Merge branch 'main' into rebase-touch-effect
jfversluis Mar 15, 2024
011e5ea
Use `uint` for Duration
brminnick Mar 16, 2024
244b4c3
Use `int` for Duration
brminnick Mar 16, 2024
5ba3492
Add TouchBehaviorDefaults
brminnick Mar 16, 2024
96a7770
Update Unit Tests
brminnick Mar 16, 2024
513493c
Remove duplicate calls to `ConfigureAwaitOptions.ForceYielding`
brminnick Mar 16, 2024
f4709fd
`dotnet format`
brminnick Mar 16, 2024
e98e230
Add nullability to `PressedBackgroundColor`
brminnick Mar 16, 2024
144d587
Remove Unused Internal Properties
brminnick Mar 16, 2024
8bc9e1b
Resolve Windows Compiler Errors
brminnick Mar 16, 2024
1a78f40
`dotnet format`
brminnick Mar 16, 2024
3b63334
Remove duplicate `splash.svg`
brminnick Mar 16, 2024
855534e
Update formatting
brminnick Mar 16, 2024
b23f0ab
Update Formatting
brminnick Mar 16, 2024
d80003e
Fix Find + Replace Error
brminnick Mar 16, 2024
f99bf24
Use Primary Constructors
brminnick Mar 16, 2024
f1c6f31
Fix find + replace error
brminnick Mar 16, 2024
fc9df95
Update StatusBarBehavior.shared.cs
brminnick Mar 16, 2024
fdcc681
Merge branch 'main' into rebase-touch-effect
brminnick Mar 17, 2024
2d798b7
Fix Splash Screen
brminnick Mar 17, 2024
fd5077a
Fix LongPress Gesture
brminnick Mar 17, 2024
a2f7b06
Update Unit Tests
brminnick Mar 17, 2024
d175734
Fix Build Errors on Windows
brminnick Mar 17, 2024
1fa7375
`dotnet format`
brminnick Mar 17, 2024
51e3a87
Fix duplicate SplashScreen
brminnick Mar 17, 2024
771c2a5
Revert splashscreen svg
brminnick Mar 17, 2024
81ae68e
Update CommunityToolkit.Maui.Sample.csproj
brminnick Mar 17, 2024
f3fdd27
Add Unit Tests for CurrentStateChanged
brminnick Mar 17, 2024
7149dcd
Add `CanExecuteTest`
brminnick Mar 17, 2024
f7f0c09
Add Unit Tests
brminnick Mar 18, 2024
415efab
Merge branch 'main' into rebase-touch-effect
brminnick Mar 18, 2024
35cc356
Update src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/To…
brminnick Mar 18, 2024
0b5a7c3
remove the ShouldUseNativeAnimation check in order to make it work
pictos Mar 18, 2024
7ef464e
Merge branch 'main' into rebase-touch-effect
brminnick Mar 24, 2024
abef80d
throw ObjectDisposedException
brminnick Mar 24, 2024
24694d5
Big Fixes + Performance Improvements
brminnick Mar 24, 2024
b505407
Remove `IsToggled`
brminnick Mar 24, 2024
e5f65f7
Update GestureManager.cs
brminnick Mar 24, 2024
dce862a
Rename `PulseCount` -> `RepeatAnimationCount`
brminnick Mar 24, 2024
7432feb
Prevent animations from happening immediately when the TouchBehavior …
brminnick Mar 25, 2024
e8efdad
Rename `Normal` -> `Default`
brminnick Mar 25, 2024
5b30dc3
Cerate `ImageTouchBehavior`
brminnick Mar 25, 2024
3253093
Move `SafeFireAndForgotExtensions`
brminnick Mar 25, 2024
dc47ac2
Update XML Documentation
brminnick Mar 25, 2024
8cd277c
Fix Windows Build Errors
brminnick Mar 25, 2024
1156050
Remove White Box
brminnick Mar 25, 2024
ce5b5e2
`Normal` -> `Default`
brminnick Mar 25, 2024
453a04d
Merge branch 'rebase-touch-effect' of https://github.com/Axemasta/Com…
brminnick Mar 25, 2024
8f88f1f
Fix Touch + Hover logic for ImageSource
brminnick Mar 25, 2024
bb6aee5
Remove `RepeatAnimationCount`
brminnick Mar 25, 2024
7511f3b
Remove `RepeatAnimationCount`
brminnick Mar 25, 2024
f735833
Fix `SetImageSource`
brminnick Mar 25, 2024
b5943dd
`ContentVIew` -> `BoxView`
brminnick Mar 25, 2024
95c64b6
Indicate Pressed and Released are Handled
kphillpotts Mar 25, 2024
6116152
Remove BoxView
brminnick Mar 25, 2024
0a2eac2
FIx Hover / Touch Logic in SetImageSource
brminnick Mar 25, 2024
9c92fdd
Merge branch 'rebase-touch-effect' of https://github.com/Axemasta/Com…
brminnick Mar 25, 2024
052db41
Refactor GestureManager, Add StateMachine tests
brminnick Mar 25, 2024
0850429
Remove Unused + Duplicate Code
brminnick Mar 25, 2024
0dd6fcd
Rename TouchBeahavior.methods.shared.cs
brminnick Mar 25, 2024
a3a1f7d
Remove NativeAnimation Logic
brminnick Mar 25, 2024
5693ccc
Remove NativeAnimation from Sample
brminnick Mar 25, 2024
da83cc9
Fix Windows Build Errors
brminnick Mar 25, 2024
a670123
Rename file
brminnick Mar 25, 2024
a3fa5ad
Merge branch 'main' into rebase-touch-effect
brminnick Mar 25, 2024
798bb90
Merge branch 'main' into rebase-touch-effect
brminnick Mar 26, 2024
a926f90
Update ImageTouchBehaviorTests.cs
brminnick Mar 27, 2024
3fcf3cf
Update ImageTouchBehaviorTests.cs
brminnick Mar 27, 2024
ad77b41
Update ImageTouchBehaviorTests.cs
brminnick Mar 27, 2024
7bc6207
Update ImageTouchBehaviorTests.cs
brminnick Mar 27, 2024
4cb4d5c
Update ImageTouchBehaviorTests.cs
brminnick Mar 27, 2024
2c9dd46
Fix merge conflicts
brminnick Mar 27, 2024
2a1c4ce
Merge branch 'main' into rebase-touch-effect
brminnick Mar 27, 2024
ab14ab5
Fix build error
brminnick Mar 27, 2024
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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ csharp_style_namespace_declarations = file_scoped:error
# CS4014: Because this call is not awaited, execution of the current method continues before the call is completed
dotnet_diagnostic.CS4014.severity = error

# CS2012: ValueTask instances returned from member invocations are intended to be directly awaited. Attempts to consume a ValueTask multiple times or to directly access one's result before it's known to be completed may result in an exception or corruption. Ignoring such a ValueTask is likely an indication of a functional bug and may degrade performance.
dotnet_diagnostic.CS2012.severity = error

# CS1998 : This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
dotnet_diagnostic.CS1998.severity = error

# Remove explicit default access modifiers
dotnet_style_require_accessibility_modifiers = omit_if_default:error

Expand Down
1 change: 1 addition & 0 deletions samples/CommunityToolkit.Maui.Sample/AppShell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public partial class AppShell : Shell
CreateViewModelMapping<SetFocusOnEntryCompletedBehaviorPage, SetFocusOnEntryCompletedBehaviorViewModel, BehaviorsGalleryPage, BehaviorsGalleryViewModel>(),
CreateViewModelMapping<StatusBarBehaviorPage, StatusBarBehaviorViewModel, BehaviorsGalleryPage, BehaviorsGalleryViewModel>(),
CreateViewModelMapping<TextValidationBehaviorPage, TextValidationBehaviorViewModel, BehaviorsGalleryPage, BehaviorsGalleryViewModel>(),
CreateViewModelMapping<TouchBehaviorPage, TouchBehaviorViewModel, BehaviorsGalleryPage, BehaviorsGalleryViewModel>(),
CreateViewModelMapping<UriValidationBehaviorPage, UriValidationBehaviorViewModel, BehaviorsGalleryPage, BehaviorsGalleryViewModel>(),
CreateViewModelMapping<UserStoppedTypingBehaviorPage, UserStoppedTypingBehaviorViewModel, BehaviorsGalleryPage, BehaviorsGalleryViewModel>(),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\splash.svg" BaseSize="128,128" Color="#512BD4" Resize="false" />

<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
Expand Down
3 changes: 2 additions & 1 deletion samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,11 @@ static void RegisterViewsAndViewModels(in IServiceCollection services)
services.AddTransientWithShellRoute<RequiredStringValidationBehaviorPage, RequiredStringValidationBehaviorViewModel>();
services.AddTransientWithShellRoute<SelectAllTextBehaviorPage, SelectAllTextBehaviorViewModel>();
services.AddTransientWithShellRoute<SetFocusOnEntryCompletedBehaviorPage, SetFocusOnEntryCompletedBehaviorViewModel>();
services.AddTransientWithShellRoute<StatusBarBehaviorPage, StatusBarBehaviorViewModel>();
services.AddTransientWithShellRoute<TextValidationBehaviorPage, TextValidationBehaviorViewModel>();
services.AddTransientWithShellRoute<TouchBehaviorPage, TouchBehaviorViewModel>();
services.AddTransientWithShellRoute<UriValidationBehaviorPage, UriValidationBehaviorViewModel>();
services.AddTransientWithShellRoute<UserStoppedTypingBehaviorPage, UserStoppedTypingBehaviorViewModel>();
services.AddTransientWithShellRoute<StatusBarBehaviorPage, StatusBarBehaviorViewModel>();

// Add Converters Pages + ViewModels
services.AddTransientWithShellRoute<BoolToObjectConverterPage, BoolToObjectConverterViewModel>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<?xml version="1.0" encoding="utf-8"?>

<pages:BasePage
x:Class="CommunityToolkit.Maui.Sample.Pages.Behaviors.TouchBehaviorPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Behaviors"
x:Name="Page"
x:DataType="vm:TouchBehaviorViewModel"
x:TypeArguments="vm:TouchBehaviorViewModel">

<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="SectionHeader" TargetType="Label">
<Setter Property="Margin" Value="0,16,0,6" />
<Setter Property="FontAttributes" Value="Bold" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="FontSize" Value="Large" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>

<ScrollView>
<VerticalStackLayout>

<Label HorizontalOptions="Center" HorizontalTextAlignment="Center"
FontSize="Body"
Text="{Binding TouchCount, StringFormat='Touches: {0}'}" />

<Label Style="{StaticResource SectionHeader}" Text="Image | Toggle" />
<Image HeightRequest="100" WidthRequest="100">
<Image.Behaviors>
<mct:ImageTouchBehavior
Command="{Binding Source={x:Reference Page}, Path=BindingContext.IncreaseTouchCountCommand}"
DefaultImageSource="button.png"
PressedImageSource="button_pressed.png" />
</Image.Behaviors>
</Image>

<Label Style="{StaticResource SectionHeader}" Text="Scale | Fade | Animated" />
<HorizontalStackLayout HorizontalOptions="CenterAndExpand" VerticalOptions="Center">
<HorizontalStackLayout.Behaviors>
<mct:TouchBehavior
DefaultAnimationDuration="250"
DefaultAnimationEasing="{x:Static Easing.CubicInOut}"
Command="{Binding Source={x:Reference Page}, Path=BindingContext.IncreaseTouchCountCommand}"
PressedOpacity="0.6"
PressedScale="0.8" />
</HorizontalStackLayout.Behaviors>

<ContentView
HeightRequest="100"
WidthRequest="10"
BackgroundColor="Gold" />
<Label Text="The entire layout receives touches" VerticalOptions="Center" LineBreakMode="TailTruncation"/>
<ContentView
HeightRequest="100"
WidthRequest="10"
BackgroundColor="Gold" />
</HorizontalStackLayout>

<Label Style="{StaticResource SectionHeader}" Text="Long Press | Hover" />

<Label
FontSize="Body"
HorizontalOptions="CenterAndExpand"
Text="{Binding LongPressCount, StringFormat='Long press count: {0}'}"
Margin="0,0,0,6" />
<HorizontalStackLayout
Padding="20"
Background="Black"
HorizontalOptions="CenterAndExpand">
<HorizontalStackLayout.Behaviors>
<mct:TouchBehavior
Command="{Binding Source={x:Reference Page}, Path=BindingContext.IncreaseTouchCountCommand}"
HoveredBackgroundColor="{StaticResource Gray900}"
HoveredScale="1.2"
LongPressCommand="{Binding Source={x:Reference Page}, Path=BindingContext.IncreaseLongPressCountCommand}" />
</HorizontalStackLayout.Behaviors>
<Label
FontSize="Large"
Text="TITLE"
TextColor="White"
VerticalOptions="Start" />
</HorizontalStackLayout>

<Label Style="{StaticResource SectionHeader}" Text="Color | Rotation | Animated" />

<HorizontalStackLayout
Padding="20"
BackgroundColor="Gold"
HorizontalOptions="CenterAndExpand">

<HorizontalStackLayout.Behaviors>
<mct:TouchBehavior
DefaultAnimationDuration="500"
Command="{Binding Source={x:Reference Page}, Path=BindingContext.IncreaseTouchCountCommand}"
DefaultBackgroundColor="Gold"
PressedBackgroundColor="Orange"
PressedRotation="15" />

</HorizontalStackLayout.Behaviors>

<Label
FontSize="Large"
Text="TITLE"
TextColor="White" />
</HorizontalStackLayout>

<Label Style="{StaticResource SectionHeader}" Text="Image | Native" />
<Border StrokeThickness="1">
<Image
HeightRequest="100"
Source="button.png"
WidthRequest="100">
<Image.Behaviors>
<mct:TouchBehavior
Command="{Binding Source={x:Reference Page}, Path=BindingContext.IncreaseTouchCountCommand}" />
</Image.Behaviors>
</Image>
</Border>

<Label Style="{StaticResource SectionHeader}" Text="Nested effect" />

<ContentView
Padding="50"
Background="Yellow"
HeightRequest="200"
HorizontalOptions="Center"
WidthRequest="200">
<ContentView.Behaviors>
<mct:TouchBehavior
Command="{Binding Source={x:Reference Page}, Path=BindingContext.ParentClickedCommand}"/>
</ContentView.Behaviors>

<ContentView
BackgroundColor="Red"
HeightRequest="100"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="100">
<ContentView.Behaviors>
<mct:TouchBehavior
Command="{Binding Source={x:Reference Page}, Path=BindingContext.ChildClickedCommand}" />
</ContentView.Behaviors>
</ContentView>
</ContentView>

<Label Style="{StaticResource SectionHeader}" Text="Input transparency for nested layouts" />

<Border
Margin="20"
Padding="20,10"
BackgroundColor="Transparent"
StrokeShape="RoundRectangle, 10"
StrokeThickness="0">
<Border.Behaviors>
<mct:TouchBehavior
DefaultAnimationDuration="150"
DefaultAnimationEasing="{x:Static Easing.CubicInOut}"
Command="{Binding Source={x:Reference Page}, Path=BindingContext.IncreaseTouchCountCommand}"
PressedBackgroundColor="LightGray"
PressedOpacity="0.8"
PressedScale="0.9"
ShouldMakeChildrenInputTransparent="True" />
</Border.Behaviors>
<Grid
BackgroundColor="Transparent"
ColumnDefinitions="Auto, *"
ColumnSpacing="10">
<Ellipse
BackgroundColor="#A4CF5B"
HeightRequest="40"
WidthRequest="40" />
<VerticalStackLayout Grid.Column="1" VerticalOptions="Center">
<Label FontSize="20" Text="Lorem Ipsum" />
<Label FontSize="12"
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam gravida, sapien in volutpat ornare, magna dui condimentum dui, quis egestas tellus leo non nulla. Quisque sit amet neque dapibus, congue justo non, dapibus dolor." />
</VerticalStackLayout>
</Grid>
</Border>
</VerticalStackLayout>
</ScrollView>
</pages:BasePage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;

namespace CommunityToolkit.Maui.Sample.Pages.Behaviors;

public partial class TouchBehaviorPage : BasePage<TouchBehaviorViewModel>
{
public TouchBehaviorPage(TouchBehaviorViewModel viewModel)
: base(viewModel)
{
InitializeComponent();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<pages:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<pages:BasePage x:Class="CommunityToolkit.Maui.Sample.Pages.Views.PopupPositionPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CommunityToolkit.Maui.Sample.Models;
using CommunityToolkit.Maui.Sample.Models;
using CommunityToolkit.Maui.Sample.ViewModels.Views;
using CommunityToolkit.Maui.Sample.Views.Popups;
using CommunityToolkit.Maui.Views;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Expand Up @@ -21,5 +21,9 @@ public class BehaviorsGalleryViewModel() : BaseGalleryViewModel(
SectionModel.Create<AnimationBehaviorViewModel>(nameof(AnimationBehavior), "Perform animation when a specified UI element event is triggered"),
SectionModel.Create<SelectAllTextBehaviorViewModel>(nameof(SelectAllTextBehavior), "Select all text inside the Entry or Editor control."),
SectionModel.Create<IconTintColorBehaviorViewModel>(nameof(IconTintColorBehavior), "Tint an icon with the selected color."),
SectionModel.Create<StatusBarBehaviorViewModel>(nameof(StatusBarBehavior), "Change the Status Bar color.")
]);
SectionModel.Create<StatusBarBehaviorViewModel>(nameof(StatusBarBehavior), "Change the Status Bar color."),
SectionModel.Create<TouchBehaviorViewModel>(nameof(TouchBehavior), "Alter a views appearance when responding to touch events (normal, pressed, hovered, long press).")
])
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;

namespace CommunityToolkit.Maui.Sample.ViewModels.Behaviors;

public partial class TouchBehaviorViewModel : BaseViewModel
{
[ObservableProperty]
int touchCount, longPressCount;

static Task DisplayAlert(string title, CancellationToken token)
=> Shell.Current.DisplayAlert(title, null, "Ok").WaitAsync(token);

[RelayCommand]
static Task ParentClicked(CancellationToken token)
=> DisplayAlert("Parent Clicked", token);

[RelayCommand]
static Task ChildClicked(CancellationToken token)
=> DisplayAlert("Child Clicked", token);

[RelayCommand]
void IncreaseTouchCount()
{
TouchCount++;
}

[RelayCommand]
void IncreaseLongPressCount()
{
LongPressCount++;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<mct:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CommunityToolkit.Maui.Sample.Views.Popups.XamlBindingPopup"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CommunityToolkit.Maui.Core.Extensions;
using CommunityToolkit.Maui.Core.Extensions;
using CommunityToolkit.Maui.Core.Views;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System.ComponentModel;

namespace CommunityToolkit.Maui.Core;

/// <summary>
/// Default Values for ImageTouchBehavior/>
/// </summary>
public static class ImageTouchBehaviorDefaults
{
/// <summary>
/// Default Value for TouchBehavior <see cref="DefaultBackgroundImageSource"/>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public const object? DefaultBackgroundImageSource = null;

/// <summary>
/// Default Value for TouchBehavior <see cref="HoveredBackgroundImageSource"/>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public const object? HoveredBackgroundImageSource = null;

/// <summary>
/// Default Value for TouchBehavior <see cref="PressedBackgroundImageSource"/>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public const object? PressedBackgroundImageSource = null;

/// <summary>
/// Default Value for TouchBehavior <see cref="DefaultBackgroundImageAspect"/>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public const Aspect DefaultBackgroundImageAspect = Aspect.AspectFit;

/// <summary>
/// Default Value for TouchBehavior <see cref="HoveredBackgroundImageAspect"/>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public const Aspect HoveredBackgroundImageAspect = Aspect.AspectFit;

/// <summary>
/// Default Value for TouchBehavior <see cref="PressedBackgroundImageAspect"/>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public const Aspect PressedBackgroundImageAspect = Aspect.AspectFit;

/// <summary>
/// Default Value for TouchBehavior <see cref="ShouldSetImageOnAnimationEnd"/>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public const bool ShouldSetImageOnAnimationEnd = false;
}
Loading