Skip to content

Add new scenarios to Input sample (PointerTracking, PointerPointProperties, DeviceCapabilities, XamlManipulations)#650

Open
qiutongMS wants to merge 4 commits into
release/experimentalfrom
user/qiutongshen/add-input-scenarios
Open

Add new scenarios to Input sample (PointerTracking, PointerPointProperties, DeviceCapabilities, XamlManipulations)#650
qiutongMS wants to merge 4 commits into
release/experimentalfrom
user/qiutongshen/add-input-scenarios

Conversation

@qiutongMS

Copy link
Copy Markdown

Summary

Adds 5 new scenario pages to the existing Input sample, migrated from Windows-universal-samples/BasicInput and windows-topic-specific-samples (branches uwp-pointers + uwp-pointers-animation).

These scenarios are referenced by multiple pages under learn.microsoft.com/windows/apps/develop/input/.

New Scenarios

# Scenario Source Description
4 PointerTracking uwp-pointers + uwp-pointers-animation Real-time pointer tracking with color-coded ellipses (mouse=gray, touch=green, pen=blue) and animated trail effects
5 Pointer Point Properties BasicInput Displays pointer properties on press — mouse buttons (red), pen pressure/barrel (yellow), touch contact rect (green)
6 Device Capabilities BasicInput Shows keyboard, mouse, and touch device capabilities using KeyboardCapabilities, MouseCapabilities, TouchCapabilities
7 XAML Manipulations BasicInput Demonstrates ManipulationMode with configurable translate axis (X/Y/both), rotation, and inertia toggle

Doc pages that reference these scenarios

Notable details

  • PointerTracking merges two separate UWP topic samples (pointer tracking + pointer animation) into a single unified scenario
  • PointerPointProperties: added Background="Transparent" on Canvas to ensure hit-test works in WinUI 3
  • Added Assets\Landscape.jpg to Content items (was missing, needed by GestureRecognizerManipulation scenario)

Testing

All 7 scenarios verified on Windows 11 with mouse + touch input in packaged mode.

Qiutong Shen and others added 3 commits July 1, 2026 09:40
Migrated from windows-topic-specific-samples (uwp-pointers + uwp-pointers-animation).
- Multi-pointer tracking with Canvas visualization
- Primary pointer detection with animated Ellipse (Storyboard)
- Handles all pointer lifecycle events

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… scenarios

- PointerPointProperties: shows pointer info (mouse buttons, pen pressure, touch contact rect) on click/touch with color-coded display
- DeviceCapabilities: displays keyboard, mouse, and touch device capabilities
- XamlManipulations: demonstrates ManipulationMode with translate, rotate, and inertia controls
- Fix Canvas Background='Transparent' for hit-test in PointerPointProperties
- Add Landscape.jpg to Content items for GestureRecognizerManipulation scenario
- Reorder launchSettings.json to default to Unpackaged profile

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the Input (cs-winui) sample by adding new scenario pages demonstrating pointer tracking, pointer point properties, device capability detection, and XAML manipulation interactions, aligning the sample with scenarios referenced by Microsoft Learn input documentation.

Changes:

  • Added new scenario pages: PointerTracking, Pointer Point Properties, Device Capabilities, and XAML Manipulations, plus a shared PointerEllipse control.
  • Updated scenario registration so the new pages appear in the sample’s navigation list.
  • Updated the project to include required content/assets and ensured new XAML pages are compiled.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
Samples/Input/cs-winui/XamlManipulations.xaml.cs Adds code-behind for manipulation transforms, options, and reset behavior.
Samples/Input/cs-winui/XamlManipulations.xaml Adds UI for manipulation scenario (axis selection, inertia toggle, reset, target element).
Samples/Input/cs-winui/SampleConfiguration.cs Registers the new scenarios in the app’s scenario list.
Samples/Input/cs-winui/Properties/launchSettings.json Reorders/normalizes debug profiles for packaged vs unpackaged runs.
Samples/Input/cs-winui/PointerTracking.xaml.cs Implements multi-pointer tracking logic and UI updates.
Samples/Input/cs-winui/PointerTracking.xaml Defines UI for pointer tracking canvas and status readouts.
Samples/Input/cs-winui/PointerPointProperties.xaml.cs Implements pointer property popups and device-specific property rendering.
Samples/Input/cs-winui/PointerPointProperties.xaml Defines UI surface for pointer property display interactions.
Samples/Input/cs-winui/PointerEllipse.xaml.cs Adds a reusable pointer visualization control with primary/secondary styling.
Samples/Input/cs-winui/PointerEllipse.xaml Defines the animated ellipse storyboard and visuals for pointer feedback.
Samples/Input/cs-winui/Input.csproj Includes new pages/assets (including Landscape.jpg) and ensures new XAML pages compile.
Samples/Input/cs-winui/DeviceCapabilities.xaml.cs Implements device capability reporting using Keyboard/Mouse/TouchCapabilities.
Samples/Input/cs-winui/DeviceCapabilities.xaml Defines UI for displaying capability results and scenario description.

Comment thread Samples/Input/cs-winui/XamlManipulations.xaml.cs Outdated
Comment thread Samples/Input/cs-winui/PointerTracking.xaml.cs Outdated
Comment thread Samples/Input/cs-winui/PointerPointProperties.xaml.cs Outdated
Comment thread Samples/Input/cs-winui/PointerEllipse.xaml.cs Outdated
Comment thread Samples/Input/cs-winui/DeviceCapabilities.xaml.cs Outdated
Comment thread Samples/Input/cs-winui/XamlManipulations.xaml.cs
- Add UTF-8 BOM to all new .cs files per .editorconfig requirement
- Replace XOR toggle with explicit set/clear for inertia ManipulationMode flags

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Comment on lines +39 to +49
private void OnPointerMoved(object sender, PointerRoutedEventArgs e)
{
PointerPoint pointerPoint = e.GetCurrentPoint(pointerCanvas);
if (ellipses.TryGetValue(pointerPoint.PointerId, out PointerEllipse ellipse))
{
UpdateEllipsePosition(ellipse, pointerPoint.Position);
UpdateLastEvent("Moved", pointerPoint.PointerId);
}

e.Handled = true;
}
Comment on lines +36 to +49
private void ApplyPointerStyle(bool isPrimary)
{
if (isPrimary)
{
ellipse.Fill = new SolidColorBrush(Colors.White);
ellipse.Stroke = new SolidColorBrush(Colors.Red);
PrimaryPointerStoryboard.Begin();
}
else
{
PrimaryPointerStoryboard.Stop();
ellipse.Fill = new SolidColorBrush(Colors.LightSkyBlue);
ellipse.Stroke = new SolidColorBrush(Colors.DodgerBlue);
}
Comment on lines +63 to +70
private void Pointer_Wheel_Changed(object sender, PointerRoutedEventArgs e)
{
PointerPoint currentPoint = e.GetCurrentPoint(mainCanvas);
if (currentPoint.IsInContact)
{
CreateOrUpdatePropertyPopUp(currentPoint);
}
}
</StackPanel>
</ScrollViewer>
<TextBlock Grid.Row="1" Text="Touch or click the screen to see information about the current pointer(s)" TextWrapping="Wrap" Padding="0,12,0,0"/>
<Canvas Grid.Row="2" x:Name="mainCanvas" Height="Auto" Margin="12,10,12,12" Background="Transparent"/>
Comment on lines +43 to +44
<Button x:Name="resetButton" Content="Reset" Margin="0,12,0,0" Click="resetButton_Pressed"
AutomationProperties.AutomationId="ResetButton"/>
new Scenario() { Title = "Gesture Recognizer Manipulations", ClassName = typeof(GestureRecognizerManipulation).FullName },
new Scenario() { Title = "Cursor", ClassName = typeof(InputCursor).FullName }
new Scenario() { Title = "Cursor", ClassName = typeof(InputCursor).FullName },
new Scenario() { Title = "PointerTracking", ClassName = typeof(PointerTracking).FullName },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants