This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
218ec6b
commit fea28a5
Showing
34 changed files
with
1,300 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,3 @@ private void AssociatedObject_DoubleTapped(object? sender, RoutedEventArgs e) | |
} | ||
} | ||
} | ||
|
42 changes: 42 additions & 0 deletions
42
src/Avalonia.Xaml.Interactions.Custom/ExecuteCommandOnGotFocusBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Reactive.Disposables; | ||
using Avalonia.Input; | ||
using Avalonia.Interactivity; | ||
|
||
namespace Avalonia.Xaml.Interactions.Custom; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public class ExecuteCommandOnGotFocusBehavior : ExecuteCommandBehaviorBase | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="disposable"></param> | ||
protected override void OnAttachedToVisualTree(CompositeDisposable disposable) | ||
{ | ||
var dispose = AssociatedObject? | ||
.AddDisposableHandler( | ||
InputElement.GotFocusEvent, | ||
AssociatedObject_GotFocus, | ||
RoutingStrategies.Tunnel | RoutingStrategies.Bubble); | ||
|
||
if (dispose is not null) | ||
{ | ||
disposable.Add(dispose); | ||
} | ||
} | ||
|
||
private void AssociatedObject_GotFocus(object? sender, RoutedEventArgs e) | ||
{ | ||
if (e.Handled) | ||
{ | ||
return; | ||
} | ||
|
||
if (ExecuteCommand()) | ||
{ | ||
e.Handled = true; | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/Avalonia.Xaml.Interactions.Custom/ExecuteCommandOnHoldingBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Reactive.Disposables; | ||
using Avalonia.Input; | ||
using Avalonia.Interactivity; | ||
|
||
namespace Avalonia.Xaml.Interactions.Custom; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public class ExecuteCommandOnHoldingBehavior : ExecuteCommandBehaviorBase | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="disposable"></param> | ||
protected override void OnAttachedToVisualTree(CompositeDisposable disposable) | ||
{ | ||
var dispose = AssociatedObject? | ||
.AddDisposableHandler( | ||
Gestures.HoldingEvent, | ||
AssociatedObject_Holding, | ||
RoutingStrategies.Tunnel | RoutingStrategies.Bubble); | ||
|
||
if (dispose is not null) | ||
{ | ||
disposable.Add(dispose); | ||
} | ||
} | ||
|
||
private void AssociatedObject_Holding(object? sender, RoutedEventArgs e) | ||
{ | ||
if (e.Handled) | ||
{ | ||
return; | ||
} | ||
|
||
if (ExecuteCommand()) | ||
{ | ||
e.Handled = true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/Avalonia.Xaml.Interactions.Custom/ExecuteCommandOnPinchBehavior.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System.Reactive.Disposables; | ||
using Avalonia.Input; | ||
using Avalonia.Interactivity; | ||
|
||
namespace Avalonia.Xaml.Interactions.Custom; | ||
|
||
/// <summary> | ||
/// | ||
/// </summary> | ||
public class ExecuteCommandOnPinchBehavior : ExecuteCommandBehaviorBase | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="disposable"></param> | ||
protected override void OnAttachedToVisualTree(CompositeDisposable disposable) | ||
{ | ||
var dispose = AssociatedObject? | ||
.AddDisposableHandler( | ||
Gestures.PinchEvent, | ||
AssociatedObject_Pinch, | ||
RoutingStrategies.Tunnel | RoutingStrategies.Bubble); | ||
|
||
if (dispose is not null) | ||
{ | ||
disposable.Add(dispose); | ||
} | ||
} | ||
|
||
private void AssociatedObject_Pinch(object? sender, RoutedEventArgs e) | ||
{ | ||
if (e.Handled) | ||
{ | ||
return; | ||
} | ||
|
||
if (ExecuteCommand()) | ||
{ | ||
e.Handled = true; | ||
} | ||
} | ||
} |
Oops, something went wrong.