-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Android Gestures * - fix drag and drop pages * - fix setting virtual view * - cleanup * - cleanup * - fix content * - cleanup * - cleanup * - only show click on catalyst and windows * - fix unit tests * - remove editorBrowsable where I could * - fix iOS * - fix winui * - change to interfaces * - fix validation service check * - fix ios gallery * Update GestureManager.cs * Update GestureManager.cs * Update GestureManager.cs * - organize
- Loading branch information
Showing
46 changed files
with
1,490 additions
and
193 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
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
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
124 changes: 124 additions & 0 deletions
124
src/Controls/samples/Controls.Sample/Pages/Gestures/ClickGestureGalleryPage.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,124 @@ | ||
using System; | ||
using Maui.Controls.Sample.Pages.Base; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Graphics; | ||
|
||
namespace Maui.Controls.Sample.Pages.Gestures | ||
{ | ||
public class ClickGestureGalleryPage : BasePage | ||
{ | ||
Command clickCommand; | ||
BoxView changeColorBoxView; | ||
|
||
public ClickGestureGalleryPage() | ||
{ | ||
clickCommand = new Command<Color>(HandleClickCommand); | ||
var vertical = new StackLayout | ||
{ | ||
VerticalOptions = LayoutOptions.Center, | ||
HorizontalOptions = LayoutOptions.Center, | ||
Spacing = 40 | ||
}; | ||
|
||
var horizontal = new StackLayout | ||
{ | ||
Orientation = StackOrientation.Horizontal, | ||
Spacing = 20, | ||
HorizontalOptions = LayoutOptions.Center, | ||
VerticalOptions = LayoutOptions.Center | ||
}; | ||
vertical.Children.Add(horizontal); | ||
|
||
var singleClickLabel = new Label | ||
{ | ||
Text = "Click me!", | ||
BackgroundColor = Colors.PaleGreen | ||
}; | ||
var singleClickGesture = new ClickGestureRecognizer | ||
{ | ||
Command = clickCommand, | ||
CommandParameter = Colors.PaleGreen, | ||
NumberOfClicksRequired = 1, | ||
Buttons = ButtonsMask.Primary | ||
}; | ||
singleClickLabel.GestureRecognizers.Add(singleClickGesture); | ||
horizontal.Children.Add(singleClickLabel); | ||
|
||
var doubleClickLabel = new Label | ||
{ | ||
Text = "Double click me!!", | ||
BackgroundColor = Colors.Aqua | ||
}; | ||
var doubleClickGesture = new ClickGestureRecognizer | ||
{ | ||
Command = clickCommand, | ||
CommandParameter = Colors.Aqua, | ||
NumberOfClicksRequired = 2, | ||
Buttons = ButtonsMask.Primary | ||
}; | ||
doubleClickLabel.GestureRecognizers.Add(doubleClickGesture); | ||
horizontal.Children.Add(doubleClickLabel); | ||
|
||
var tripleClicklabel = new Label | ||
{ | ||
Text = "Triple click me!!!", | ||
BackgroundColor = Colors.Olive | ||
}; | ||
var tripleClickGesture = new ClickGestureRecognizer | ||
{ | ||
Command = clickCommand, | ||
CommandParameter = Colors.Olive, | ||
NumberOfClicksRequired = 3, | ||
Buttons = ButtonsMask.Primary | ||
}; | ||
tripleClicklabel.GestureRecognizers.Add(tripleClickGesture); | ||
horizontal.Children.Add(tripleClicklabel); | ||
|
||
var rightClickLabel = new Label | ||
{ | ||
Text = "Right click me¡", | ||
BackgroundColor = Colors.Coral | ||
}; | ||
var rigthClickGesture = new ClickGestureRecognizer | ||
{ | ||
Command = clickCommand, | ||
CommandParameter = Colors.Coral, | ||
NumberOfClicksRequired = 1, | ||
Buttons = ButtonsMask.Secondary | ||
}; | ||
rightClickLabel.GestureRecognizers.Add(rigthClickGesture); | ||
horizontal.Children.Add(rightClickLabel); | ||
|
||
var doubleRightClickLabel = new Label | ||
{ | ||
Text = "Double right click me¡¡", | ||
BackgroundColor = Colors.Gold | ||
}; | ||
var doubleRigthClickGesture = new ClickGestureRecognizer | ||
{ | ||
Command = clickCommand, | ||
CommandParameter = Colors.Gold, | ||
NumberOfClicksRequired = 2, | ||
Buttons = ButtonsMask.Secondary | ||
}; | ||
doubleRightClickLabel.GestureRecognizers.Add(doubleRigthClickGesture); | ||
horizontal.Children.Add(doubleRightClickLabel); | ||
|
||
|
||
changeColorBoxView = new BoxView | ||
{ | ||
VerticalOptions = LayoutOptions.CenterAndExpand, | ||
HorizontalOptions = LayoutOptions.CenterAndExpand, | ||
WidthRequest = 200, | ||
HeightRequest = 50 | ||
}; | ||
vertical.Children.Add(changeColorBoxView); | ||
Content = vertical; | ||
} | ||
|
||
void HandleClickCommand(Color backgroundColor) | ||
{ | ||
changeColorBoxView.BackgroundColor = backgroundColor; | ||
} | ||
} | ||
} |
Oops, something went wrong.