Skip to content

Commit c8e37b5

Browse files
authored
Input Samples (#231)
Adding Input Samples to the repository
1 parent b03b0e4 commit c8e37b5

34 files changed

+1324
-0
lines changed

Samples/Input/cs-winui/App.xaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!-- Copyright (c) Microsoft Corporation.
2+
Licensed under the MIT License. -->
3+
<Application
4+
x:Class="Input.App"
5+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
6+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
7+
xmlns:local="using:Input">
8+
9+
<Application.Resources>
10+
<!-- Application-specific resources -->
11+
<ResourceDictionary>
12+
<ResourceDictionary.MergedDictionaries>
13+
<!--
14+
Styles that define common aspects of the platform look and feel
15+
Required by Visual Studio project and item templates
16+
-->
17+
<ResourceDictionary Source="ms-appx:///Styles.xaml"/>
18+
</ResourceDictionary.MergedDictionaries>
19+
</ResourceDictionary>
20+
</Application.Resources>
21+
</Application>

Samples/Input/cs-winui/App.xaml.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
using Microsoft.UI.Xaml;
5+
6+
namespace Input
7+
{
8+
public partial class App : Application
9+
{
10+
private Window mainWindow;
11+
12+
public App()
13+
{
14+
this.InitializeComponent();
15+
}
16+
17+
protected override void OnLaunched(LaunchActivatedEventArgs args)
18+
{
19+
mainWindow = new MainWindow();
20+
mainWindow.Activate();
21+
}
22+
}
23+
}
34.6 KB
Loading
76.3 KB
Loading
10.6 KB
Loading
2.73 KB
Loading
10.9 KB
Loading
3.06 KB
Loading
2.1 KB
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!-- Copyright (c) Microsoft Corporation.
2+
Licensed under the MIT License. -->
3+
<Page
4+
x:Class="Input.GestureRecognizer"
5+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
6+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
7+
xmlns:local="using:Input"
8+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
9+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
10+
mc:Ignorable="d">
11+
12+
<Grid x:Name="Grid" Margin="30, 0, 30, 0" Background="Transparent" RowDefinitions="100, 50, *">
13+
<TextBlock Grid.Row="0" Style="{StaticResource ScenarioDescriptionTextStyle}" TextWrapping="Wrap">
14+
Demonstrates GestureRecognizer's Tap, Double Tap, Right Tap, Drag, and Hold events by
15+
changing the rectangle's color when a different gesture is detected on the rectangle.
16+
The rectangle's GestureRecognizer supports mouse, touch and pen for all events with
17+
the exception of Drag, which only supports mouse and pen.
18+
</TextBlock>
19+
<StackPanel Grid.Row="1" Orientation="Horizontal" Spacing="10">
20+
<TextBlock
21+
Text="Gesture Recognizer Result:"
22+
Margin="0,5,0,0"/>
23+
<TextBlock
24+
x:Name="GestureResultText"
25+
Margin="0,5,0,0"/>
26+
</StackPanel>
27+
28+
<Rectangle
29+
Grid.Row="2"
30+
x:Name="GestureRectangle"
31+
Fill="Red"
32+
Width="100"
33+
Height="100"
34+
PointerPressed="OnPointerPressed"
35+
PointerMoved="OnPointerMoved"
36+
PointerReleased="OnPointerReleased"
37+
PointerCanceled="OnPointerCanceled"/>
38+
</Grid>
39+
</Page>

0 commit comments

Comments
 (0)