Created
April 24, 2020 16:30
-
-
Save SQL-MisterMagoo/1ff4e489a4b43e1f931549178dd0c4d4 to your computer and use it in GitHub Desktop.
TouchEvents example
This file contains hidden or 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
<main @ontouchstart="TouchStart" @ontouchend="TouchEnd" style="height:100vh;"> | |
<Router AppAssembly="@typeof(Program).Assembly"> | |
<Found Context="routeData"> | |
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> | |
</Found> | |
<NotFound> | |
<LayoutView Layout="@typeof(MainLayout)"> | |
<p>Sorry, there's nothing at this address.</p> | |
</LayoutView> | |
</NotFound> | |
</Router> | |
</main> | |
@code | |
{ | |
void TouchStart(TouchEventArgs args) | |
{ | |
Console.WriteLine($"Started with {args.Touches.Length} touches"); | |
foreach (var touch in args.Touches) | |
{ | |
Console.WriteLine($"Started with {touch.ClientX},{touch.ClientY} point"); | |
} | |
} | |
void TouchEnd(TouchEventArgs args) | |
{ | |
Console.WriteLine($"Ended with {args.Touches.Length} touches"); | |
foreach (var touch in args.Touches) | |
{ | |
Console.WriteLine($"Ended with {touch.ClientX},{touch.ClientY} point"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment