Skip to content

Commit 04b375f

Browse files
authored
Cleaning input (#6355)
1 parent 81011a2 commit 04b375f

11 files changed

Lines changed: 73 additions & 479 deletions

hub/apps/develop/input/access-keys.md

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -114,86 +114,6 @@ _CommandBar primary scope and supported access keys_
114114

115115
_CommandBar secondary scope and supported access keys_
116116

117-
### Windows 10 Creators Update and older
118-
119-
Prior to Windows 10 Fall Creators Update, some controls, such as the CommandBar, didn't support built-in access key scopes.
120-
121-
The following example shows how to support CommandBar SecondaryCommands with access keys, which are available once a parent command is invoked (similar to the Ribbon in Word).
122-
123-
```xaml
124-
<local:CommandBarHack x:Name="MainCommandBar" AccessKey="M" >
125-
<AppBarButton AccessKey="G" Icon="Globe" Label="Go"/>
126-
<AppBarButton AccessKey="S" Icon="Stop" Label="Stop"/>
127-
<AppBarSeparator/>
128-
<AppBarButton AccessKey="R" Icon="Refresh" Label="Refresh" IsAccessKeyScope="True">
129-
<AppBarButton.Flyout>
130-
<MenuFlyout>
131-
<MenuFlyoutItem AccessKey="A" Icon="Globe" Text="Refresh A" />
132-
<MenuFlyoutItem AccessKey="B" Icon="Globe" Text="Refresh B" />
133-
<MenuFlyoutItem AccessKey="C" Icon="Globe" Text="Refresh C" />
134-
<MenuFlyoutItem AccessKey="D" Icon="Globe" Text="Refresh D" />
135-
</MenuFlyout>
136-
</AppBarButton.Flyout>
137-
</AppBarButton>
138-
<AppBarButton AccessKey="B" Icon="Back" Label="Back"/>
139-
<AppBarButton AccessKey="F" Icon="Forward" Label="Forward"/>
140-
<AppBarSeparator/>
141-
<AppBarToggleButton AccessKey="T" Icon="Favorite" Label="Favorite"/>
142-
<CommandBar.SecondaryCommands>
143-
<AppBarToggleButton Icon="Like" AccessKey="L" Label="Like"/>
144-
<AppBarButton Icon="Setting" AccessKey="S" Label="Settings" />
145-
</CommandBar.SecondaryCommands>
146-
</local:CommandBarHack>
147-
```
148-
149-
```csharp
150-
public class CommandBarHack : CommandBar
151-
{
152-
CommandBarOverflowPresenter secondaryItemsControl;
153-
Popup overflowPopup;
154-
155-
public CommandBarHack()
156-
{
157-
this.ExitDisplayModeOnAccessKeyInvoked = false;
158-
AccessKeyInvoked += OnAccessKeyInvoked;
159-
}
160-
161-
protected override void OnApplyTemplate()
162-
{
163-
base.OnApplyTemplate();
164-
165-
Button moreButton = GetTemplateChild("MoreButton") as Button;
166-
moreButton.SetValue(Control.IsTemplateKeyTipTargetProperty, true);
167-
moreButton.IsAccessKeyScope = true;
168-
169-
// SecondaryItemsControl changes
170-
secondaryItemsControl = GetTemplateChild("SecondaryItemsControl") as CommandBarOverflowPresenter;
171-
secondaryItemsControl.AccessKeyScopeOwner = moreButton;
172-
173-
overflowPopup = GetTemplateChild("OverflowPopup") as Popup;
174-
}
175-
176-
private void OnAccessKeyInvoked(UIElement sender, AccessKeyInvokedEventArgs args)
177-
{
178-
if (overflowPopup != null)
179-
{
180-
overflowPopup.Opened += SecondaryMenuOpened;
181-
}
182-
}
183-
184-
private void SecondaryMenuOpened(object sender, object e)
185-
{
186-
//This is not necessary given we are automatically pushing the scope.
187-
var item = secondaryItemsControl.Items.First();
188-
if (item != null && item is Control)
189-
{
190-
(item as Control).Focus(FocusState.Keyboard);
191-
}
192-
overflowPopup.Opened -= SecondaryMenuOpened;
193-
}
194-
}
195-
```
196-
197117
## Avoid access key collisions
198118

199119
Access key collisions occur when two or more elements in the same scope have duplicate access keys, or start with the same alphanumeric characters.

hub/apps/develop/input/focus-navigation.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ dev-contact: niallm
1212
doc-status: Published
1313
ms.localizationpriority: medium
1414
---
15-
# Focus navigation for keyboard, gamepad, remote control, and accessibility tools
16-
17-
![Keyboard, remote, and D-pad](images/dpad-remote/dpad-remote-keyboard.png)
15+
# Focus navigation for keyboard and accessibility tools
1816

1917
Use focus navigation to provide comprehensive and consistent interaction experiences in your Windows apps and custom controls for keyboard power users, those with disabilities and other accessibility requirements, as well as the 10-foot experience of television screens and the Xbox One.
2018

hub/apps/develop/input/guidelines-for-targeting.md

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,9 @@ In this topic, we describe these default behaviors so you can design your app fo
2222

2323
> **Important APIs**: [**Windows.UI.Core**](/uwp/api/Windows.UI.Core), [**Windows.UI.Input**](/uwp/api/Windows.UI.Input), [**Windows.UI.Xaml.Input**](/uwp/api/Windows.UI.Xaml.Input)
2424
25-
## Fluent Standard sizing
26-
27-
*Fluent Standard sizing* was created to provide a balance between information density and user comfort. Effectively, all items on the screen align to a 40x40 effective pixels (epx) target, which lets UI elements align to a grid and scale appropriately based on system level scaling.
28-
29-
> [!NOTE]
30-
> For more info on effective pixels and scaling, see [Screen sizes and breakpoints](../../design/layout/screen-sizes-and-breakpoints-for-responsive-design.md#effective-pixels-and-scale-factor)
31-
>
32-
> For more info on system level scaling, see [Alignment, margin, padding](../../design/layout/alignment-margin-padding.md).
33-
34-
## Fluent Compact sizing
35-
36-
Applications can display a higher level of information density with *Fluent Compact sizing*. Compact sizing aligns UI elements to a 32x32 epx target, which lets UI elements to align to a tighter grid and scale appropriately based on system level scaling.
37-
38-
### Examples
39-
40-
Compact sizing can be applied at the page or grid level.
41-
42-
### Page level
43-
44-
```xaml
45-
<Page.Resources>
46-
<ResourceDictionary Source="ms-appx:///Microsoft.UI.Xaml/DensityStyles/Compact.xaml" />
47-
</Page.Resources>
48-
```
49-
50-
### Grid level
51-
52-
```xaml
53-
<Grid>
54-
<Grid.Resources>
55-
<ResourceDictionary Source="ms-appx:///Microsoft.UI.Xaml/DensityStyles/Compact.xaml" />
56-
</Grid.Resources>
57-
</Grid>
58-
```
59-
6025
## Target size
6126

62-
In general, set your touch target size to 7.5mm square range (40x40 pixels on a 135 PPI display at a 1.0x scaling plateau). Typically, UWP controls align with 7.5mm touch target (this can vary based on the specific control and any common usage patterns). See [Control size and density](../../design/style/spacing.md) for more detail.
27+
In general, set your touch target size to 7.5mm square range (40x40 pixels on a 135 PPI display at a 1.0x scaling plateau). Typically, WinUI controls align with 7.5mm touch target (this can vary based on the specific control and any common usage patterns). See [Control size and density](../../design/style/spacing.md) for more detail.
6328

6429
These target size recommendations can be adjusted as required by your particular scenario. Here are some things to consider:
6530

hub/apps/develop/input/handle-pointer-input.md

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -40,82 +40,16 @@ Windows apps can listen for the following pointer events:
4040
> [!NOTE]
4141
> Constrain pointer input to a specific UI element by calling [**CapturePointer**](/uwp/api/windows.ui.xaml.uielement.capturepointer) on that element within a pointer event handler. When a pointer is captured by an element, only that object receives pointer input events, even when the pointer moves outside the bounding area of the object. The [**IsInContact**](/uwp/api/windows.ui.xaml.input.pointer.isincontact) (mouse button pressed, touch or stylus in contact) must be true for **CapturePointer** to be successful.
4242
43-
<table>
44-
<colgroup>
45-
<col width="50%" />
46-
<col width="50%" />
47-
</colgroup>
48-
<thead>
49-
<tr class="header">
50-
<th align="left">Event</th>
51-
<th align="left">Description</th>
52-
</tr>
53-
</thead>
54-
<tbody>
55-
<tr class="odd">
56-
<td align="left"><p><a href="/uwp/api/windows.ui.xaml.uielement.pointercanceled"><strong>PointerCanceled</strong></a></p></td>
57-
<td align="left"><p>Occurs when a pointer is canceled by the platform. This can occur in the following circumstances:</p>
58-
<ul>
59-
<li>Touch pointers are canceled when a pen is detected within range of the input surface.</li>
60-
<li>An active contact is not detected for more than 100 ms.</li>
61-
<li>Monitor/display is changed (resolution, settings, multi-mon configuration).</li>
62-
<li>The desktop is locked or the user has logged off.</li>
63-
<li>The number of simultaneous contacts exceeded the number supported by the device.</li>
64-
</ul></td>
65-
</tr>
66-
<tr class="even">
67-
<td align="left"><p><a href="/uwp/api/windows.ui.xaml.uielement.pointercapturelost"><strong>PointerCaptureLost</strong></a></p></td>
68-
<td align="left"><p>Occurs when another UI element captures the pointer, the pointer was released, or another pointer was programmatically captured.</p>
69-
<div class="alert">
70-
<strong>Note</strong>  There is no corresponding pointer capture event.
71-
</div>
72-
<div>
73-
 
74-
</div></td>
75-
</tr>
76-
<tr class="odd">
77-
<td align="left"><p><a href="/uwp/api/windows.ui.xaml.uielement.pointerentered"><strong>PointerEntered</strong></a></p></td>
78-
<td align="left"><p>Occurs when a pointer enters the bounding area of an element. This can happen in slightly different ways for touch, touchpad, mouse, and pen input.</p>
79-
<ul>
80-
<li>Touch requires a finger contact to fire this event, either from a direct touch down on the element or from moving into the bounding area of the element.</li>
81-
<li>Mouse and touchpad both have an on-screen cursor that is always visible and fires this event even if no mouse or touchpad button is pressed.</li>
82-
<li>Like touch, pen fires this event with a direct pen down on the element or from moving into the bounding area of the element. However, pen also has a hover state (<a href="/uwp/api/windows.ui.xaml.input.pointer.isinrange">IsInRange</a>) that, when true, fires this event.</li>
83-
</ul></td>
84-
</tr>
85-
<tr class="even">
86-
<td align="left"><p><a href="/uwp/api/windows.ui.xaml.uielement.pointerexited"><strong>PointerExited</strong></a></p></td>
87-
<td align="left"><p>Occurs when a pointer leaves the bounding area of an element. This can happen in slightly different ways for touch, touchpad, mouse, and pen input.</p>
88-
<ul>
89-
<li>Touch requires a finger contact and fires this event when the pointer moves out of the bounding area of the element.</li>
90-
<li>Mouse and touchpad both have an on-screen cursor that is always visible and fires this event even if no mouse or touchpad button is pressed.</li>
91-
<li>Like touch, pen fires this event when moving out of the bounding area of the element. However, pen also has a hover state (<a href="/uwp/api/windows.ui.xaml.input.pointer.isinrange">IsInRange</a>) that fires this event when the state changes from true to false.</li>
92-
</ul></td>
93-
</tr>
94-
<tr class="odd">
95-
<td align="left"><p><a href="/uwp/api/windows.ui.xaml.uielement.pointermoved"><strong>PointerMoved</strong></a></p></td>
96-
<td align="left"><p>Occurs when a pointer changes coordinates, button state, pressure, tilt, or contact geometry (for example, width and height) within the bounding area of an element. This can happen in slightly different ways for touch, touchpad, mouse, and pen input.</p>
97-
<ul>
98-
<li>Touch requires a finger contact and fires this event only when in contact within the bounding area of the element.</li>
99-
<li>Mouse and touchpad both have an on-screen cursor that is always visible and fires this event even if no mouse or touchpad button is pressed.</li>
100-
<li>Like touch, pen fires this event when in contact within the bounding area of the element. However, pen also has a hover state (<a href="/uwp/api/windows.ui.xaml.input.pointer.isinrange">IsInRange</a>) that, when true and within the bounding area of the element, fires this event.</li>
101-
</ul></td>
102-
</tr>
103-
<tr class="even">
104-
<td align="left"><p><a href="/uwp/api/windows.ui.xaml.uielement.pointerpressed"><strong>PointerPressed</strong></a></p></td>
105-
<td align="left"><p>Occurs when the pointer indicates a press action (such as a touch down, mouse button down, pen down, or touchpad button down) within the bounding area of an element.</p>
106-
<p><a href="/uwp/api/windows.ui.xaml.uielement.capturepointer">CapturePointer</a> must be called from the handler for this event.</p></td>
107-
</tr>
108-
<tr class="odd">
109-
<td align="left"><p><a href="/uwp/api/windows.ui.xaml.uielement.pointerreleased"><strong>PointerReleased</strong></a></p></td>
110-
<td align="left"><p>Occurs when the pointer indicates a release action (such as a touch up, mouse button up, pen up, or touchpad button up) within the bounding area of an element or, if the pointer is captured, outside the bounding area.</p></td>
111-
</tr>
112-
<tr class="even">
113-
<td align="left"><p><a href="/uwp/api/windows.ui.xaml.uielement.pointerwheelchanged"><strong>PointerWheelChanged</strong></a></p></td>
114-
<td align="left"><p>Occurs when the mouse wheel is rotated.</p>
115-
<p>Mouse input is associated with a single pointer assigned when mouse input is first detected. Clicking a mouse button (left, wheel, or right) creates a secondary association between the pointer and that button through the <a href="/uwp/api/windows.ui.xaml.uielement.pointermoved">PointerMoved</a> event.</p></td>
116-
</tr>
117-
</tbody>
118-
</table
43+
| Event | Description |
44+
|---|---|
45+
| [**PointerCanceled**](/uwp/api/windows.ui.xaml.uielement.pointercanceled) | Occurs when a pointer is canceled by the platform. This can occur in the following circumstances:<ul><li>Touch pointers are canceled when a pen is detected within range of the input surface.</li><li>An active contact is not detected for more than 100 ms.</li><li>Monitor/display is changed (resolution, settings, multi-mon configuration).</li><li>The desktop is locked or the user has logged off.</li><li>The number of simultaneous contacts exceeded the number supported by the device.</li></ul> |
46+
| [**PointerCaptureLost**](/uwp/api/windows.ui.xaml.uielement.pointercapturelost) | Occurs when another UI element captures the pointer, the pointer was released, or another pointer was programmatically captured.<br>**Note:** There is no corresponding pointer capture event. |
47+
| [**PointerEntered**](/uwp/api/windows.ui.xaml.uielement.pointerentered) | Occurs when a pointer enters the bounding area of an element. This can happen in slightly different ways for touch, touchpad, mouse, and pen input.<ul><li>Touch requires a finger contact to fire this event, either from a direct touch down on the element or from moving into the bounding area of the element.</li><li>Mouse and touchpad both have an on-screen cursor that is always visible and fires this event even if no mouse or touchpad button is pressed.</li><li>Like touch, pen fires this event with a direct pen down on the element or from moving into the bounding area of the element. However, pen also has a hover state ([IsInRange](/uwp/api/windows.ui.xaml.input.pointer.isinrange)) that, when true, fires this event.</li></ul> |
48+
| [**PointerExited**](/uwp/api/windows.ui.xaml.uielement.pointerexited) | Occurs when a pointer leaves the bounding area of an element. This can happen in slightly different ways for touch, touchpad, mouse, and pen input.<ul><li>Touch requires a finger contact and fires this event when the pointer moves out of the bounding area of the element.</li><li>Mouse and touchpad both have an on-screen cursor that is always visible and fires this event even if no mouse or touchpad button is pressed.</li><li>Like touch, pen fires this event when moving out of the bounding area of the element. However, pen also has a hover state ([IsInRange](/uwp/api/windows.ui.xaml.input.pointer.isinrange)) that fires this event when the state changes from true to false.</li></ul> |
49+
| [**PointerMoved**](/uwp/api/windows.ui.xaml.uielement.pointermoved) | Occurs when a pointer changes coordinates, button state, pressure, tilt, or contact geometry (for example, width and height) within the bounding area of an element. This can happen in slightly different ways for touch, touchpad, mouse, and pen input.<ul><li>Touch requires a finger contact and fires this event only when in contact within the bounding area of the element.</li><li>Mouse and touchpad both have an on-screen cursor that is always visible and fires this event even if no mouse or touchpad button is pressed.</li><li>Like touch, pen fires this event when in contact within the bounding area of the element. However, pen also has a hover state ([IsInRange](/uwp/api/windows.ui.xaml.input.pointer.isinrange)) that, when true and within the bounding area of the element, fires this event.</li></ul> |
50+
| [**PointerPressed**](/uwp/api/windows.ui.xaml.uielement.pointerpressed) | Occurs when the pointer indicates a press action (such as a touch down, mouse button down, pen down, or touchpad button down) within the bounding area of an element.<br>[CapturePointer](/uwp/api/windows.ui.xaml.uielement.capturepointer) must be called from the handler for this event. |
51+
| [**PointerReleased**](/uwp/api/windows.ui.xaml.uielement.pointerreleased) | Occurs when the pointer indicates a release action (such as a touch up, mouse button up, pen up, or touchpad button up) within the bounding area of an element or, if the pointer is captured, outside the bounding area. |
52+
| [**PointerWheelChanged**](/uwp/api/windows.ui.xaml.uielement.pointerwheelchanged) | Occurs when the mouse wheel is rotated.<br>Mouse input is associated with a single pointer assigned when mouse input is first detected. Clicking a mouse button (left, wheel, or right) creates a secondary association between the pointer and that button through the [PointerMoved](/uwp/api/windows.ui.xaml.uielement.pointermoved) event. | 
11953

12054
## Pointer event example
12155

0 commit comments

Comments
 (0)