You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Measure/Arrange layout passes** -- Gum uses its own layout engine with unit types
698
699
***Margin / Padding properties** -- spacing is achieved through layout values, `Spacing`, and container nesting
700
+
***Button.IsDefault / IsCancel** -- Game UIs typically handle default/cancel actions via gamepad or global input state machines rather than localized button properties.
Copy file name to clipboardExpand all lines: docs/code/controls/checkbox.md
+19Lines changed: 19 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,25 @@ checkBox3.IsChecked = null;
53
53
54
54
[Try on XnaFiddle.NET](https://xnafiddle.net/#snippet=H4sIAAAAAAAAA6tW8ix2L81VsiopKk3VUcrMyyzJTMzJrEpVslIqSyxSKC5JTM4OSMxLzVGwVchLLVcIhgtoaFrH5CHk9RxTUkLyg_LzS8ASIM3JGanJ2U75FVCtzlAuFo3OGZk5KRow9SB5GFvPsxisLzUFaArIkWhmG5FquBGy6UYoxqcl5hSjm29MqvnGyOYbo5ifV5qTY61UCwD-QP0DdAEAAA)
55
55
56
+
### Three State CheckBox (IsThreeState)
57
+
58
+
By default, a CheckBox only cycles between `Checked` and `Unchecked` when clicked. Setting `IsThreeState` to `true` allows the user to cycle through all three states by clicking.
59
+
60
+
When `IsThreeState` is true, clicking the CheckBox follows this cycle:
[Try on XnaFiddle.NET](https://xnafiddle.net/#snippet=H4sIAAAAAAAAA1VPwWrDMAz9FaNTCsVk3S1hh6WHUlgZbB07LDtkjbqqOHJxZDZW-u-zmpRSH_SkJ-n56QjLfhE7KCREnELsib97KD4gkfadAm5D0yF8ToGYhBpHfwgFPFEvlf81bsQHw_iTTcqaR8Y-tu3av3gvtyxvdj5kA9g5smDQ_jaRxGLIJKm8TFjHPL-fmzstNJ9VQ5zUfKzZpDd6WAp2hjRcTWhbKft2aBvBtX_-2uNGsrPE7LwxpANUhi5bF6M60-sRmepo93S94hVdUiPPK99i-vamtqvohA4OSzj9Aw4ZK_xeAQAA)
204
204
205
+
### Accessing Multiple Selections
206
+
207
+
When using `SelectionMode.Multiple` or `SelectionMode.Extended`, you can access all currently selected items using the `SelectedItems` property. This property returns a `System.Collections.IList` containing the selected objects.
208
+
209
+
The `SelectedObject` and `SelectedIndex` properties are still available, but they will only return the **first** item in the selection.
210
+
211
+
The following code shows how to iterate over all selected items:
The `DragDropReorderMode` controls whether the user can automatically reorder `ListBoxItems` by pushing on an item and dragging it to a new location. By default this value is set to `NoReorder`, but it can be changed to enable reordering.
[Try on XnaFiddle.NET](https://xnafiddle.net/#snippet=H4sIAAAAAAAACm2PTQvCMAyG7wP_Q-hpooj4cVCZoCLTm8hAhcKYtrjibGXLVBT_u92sX9Nb8rwJeXItWQBkmrjpnnQB45RXcyKkQBFE4sI1JscghkOQJCcVs6E6gwOSn2D2Jna5R-XHRG3AmKfmSuFPstTb7XoBrv7BhWAY6qBRLyYTLrYh6qjZKiSzKNjwUEWMxzqmZCxRV09TSvQ4ldk76xRRSfPJMG9y1Qcv-Bv4Ujd9Zt356D1-zqQocTl-3zQDo0hsdlBxwPar4JfB6RuP5-rXK6bukZJ1uwOuo6mUqAEAAA)
31
31
32
+
## PasswordChar
33
+
34
+
The `PasswordChar` property can be used to customize the character that masks the actual text entered by the user. By default, this is an asterisk (`*`).
35
+
36
+
The following changes the `PasswordChar`:
37
+
38
+
```csharp
39
+
// Initialize
40
+
varpasswordBox=newPasswordBox();
41
+
passwordBox.PasswordChar='#';
42
+
passwordBox.AddToRoot();
43
+
```
44
+
45
+
[Try on XnaFiddle.NET](https://xnafiddle.net/#snippet=H4sIAAAAAAAAA6tW8ix2L81VsiopKk3VUSotzsxLL1ayilYCCuqFZxalphUl5qYqxeooZeZllmQm5mRWpSpZKZUlFikUJBYXl-cXpTjlVyjYKuSllisEIEQ0NK1j8pBU6MHknDOAWm0VYkoNDIzMlSEUmlLHlJSQ_KD8_BKgIUq1ADyYlTeiAAAA)
46
+
32
47
<figure><imgsrc="../../.gitbook/assets/13_22 15 31.gif"alt=""><figcaption><p>Password entered in a PasswordBox</p></figcaption></figure>
Copy file name to clipboardExpand all lines: docs/code/controls/textbox.md
+25-6Lines changed: 25 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,6 +98,23 @@ panel.AddChild(textBox);
98
98
99
99
<figure><imgsrc="../../.gitbook/assets/13_09 59 12.gif"alt=""><figcaption><p>TextBox with IsReadOnly set to true responding to mouse click+drag and double-click</p></figcaption></figure>
100
100
101
+
## MaxLength
102
+
103
+
The `MaxLength` property can be used to restrict the number of characters that can be entered into a `TextBox`. This limit applies to both user typing and pasting. If a user attempts to type more characters than allowed, the extra characters are ignored. If a user pastes a string that would exceed the limit, the string is truncated to fit.
104
+
105
+
The following code creates a `TextBox` with a `MaxLength` of 10:
106
+
107
+
```csharp
108
+
// Initialize
109
+
vartextBox=newTextBox();
110
+
textBox.AddToRoot();
111
+
textBox.MaxLength=10;
112
+
// only 10 characters show:
113
+
textBox.Text="abcdefghijklmnopqrs";
114
+
```
115
+
116
+
[Try on XnaFiddle.NET](https://xnafiddle.net/#snippet=H4sIAAAAAAAAA1WMsQrCMBRFfyW8SaGU2LHFQRcRdJGCg3WI5rV92iaavGhR_HcrddDxnsO5T1j6RWghZRcwguDJVB7SHfQw3pLD0qkWYR8BGWJSDT0QUrgpJxg7nttOTIXBu8iHNRpnhfmaeKZ1bjfW8h9dq26FpuK6LyfyR3wuelYEKZNEHY4ay6qm07lpjb1cnR9EBq83c7Gb4LUAAAA)
117
+
101
118
## Selection
102
119
103
120
Selection can be performed programmatically or by the user using the cursor.
The `TextBox.Text` propertycanbeboundtoaViewModel's property. By default this property is updated immediately when text changes but the `UpdateSourceTrigger` can be set to `UpdateSourceTrigger.LostFocus`.
Copy file name to clipboardExpand all lines: docs/code/events-and-interactivity/tabbing-moving-focus.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,13 @@ The keyboard can be used to interact with controls. Keyboards can be used to:
16
16
* To click controls by pressing enter
17
17
* To perform control-specific actions such as changing the value of a slider
18
18
19
-
To enable gamepad control, add the following code. This code only needs to run once, so add it to your game's Initialize or other code which runs at startup.
19
+
### Tab Key Capture (AcceptsTab)
20
+
21
+
By default, the Tab key is used for navigation. However, certain controls like `TextBox` and `PasswordBox` can be configured to capture the Tab key to insert a tab character instead of moving focus.
22
+
23
+
When a `TextBox` has its `AcceptsTab` property set to `true`, focus navigation via the Tab key is disabled for that control. You can still move focus using the mouse or other input methods. For more details, see the [TextBox Tab Key Behavior](../controls/textbox.md#tab-key-behavior) section.
24
+
25
+
To enable keyboard tabbing, add the following code. This code only needs to run once, so add it to your game's Initialize or other code which runs at startup.
0 commit comments