-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rename Accelerator to KeyboardAccelerator and Refactor APIs #16740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
11440f3
Rename all accelerator things to keyboardAccelerator - first pass
rachelkang 56b70dc
Remove original PR API changes and tweak more stuff
rachelkang 312a281
Merge branch 'main' into rename-keyboard-accelerators
rachelkang 0ed339d
Merge branch 'main' into rename-keyboard-accelerators
rachelkang 45709b2
Merge branch 'main' into rename-keyboard-accelerators
rachelkang 480c15d
Merge branch 'main' into rename-keyboard-accelerators
rachelkang ca3ca72
Update PublicAPI.Unshipped.txt
rachelkang c862347
Fix API diffs
rachelkang 2a53635
Add more comprehensive MenuFlyoutItem and SubItem samples
rachelkang f3d993d
Merge branch 'main' into rename-keyboard-accelerators
rachelkang 0d6b661
Merge remote-tracking branch 'origin/main' into rename-keyboard-accel…
mattleibow 2156d4b
Merge branch 'main' into rename-keyboard-accelerators
rachelkang 297c75e
The great KA refactoring
rachelkang c76112d
Merge branch 'main' into rename-keyboard-accelerators
rachelkang 256e77c
Tweaks for Mac
rachelkang 693bbb6
Hold back AlphaShift and NumericPad support
rachelkang 72fd314
Clean up tests
rachelkang a8baf44
Respond to feedback
rachelkang eea29ad
Add null check
rachelkang 75bb996
Respond to feedback
rachelkang 8ef3b8e
Add multiple accelerators sample
rachelkang 7198250
Respond to feedback
rachelkang 7ce795f
Tweak API docs
rachelkang cfa3a7c
Update PubliAPI.Unshipped files
rachelkang ed6100e
Merge branch 'main' into rename-keyboard-accelerators
rachelkang b55b318
Remove Mac prioritization over system behavior
rachelkang f0543f0
Tweak API updates in Tizen
rachelkang 5271f00
Merge branch 'main' into rename-keyboard-accelerators
mattleibow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| namespace Microsoft.Maui.Controls | ||
| { | ||
| /// <summary> | ||
| /// Represents a shortcut key for a <see cref="MenuFlyoutItem"/>. | ||
| /// </summary> | ||
| public class KeyboardAccelerator : BindableObject, IKeyboardAccelerator | ||
| { | ||
| /// <summary> | ||
| /// Bindable property for <see cref="Modifiers"/>. | ||
| /// </summary> | ||
| public static readonly BindableProperty ModifiersProperty = BindableProperty.Create(nameof(Modifiers), typeof(KeyboardAcceleratorModifiers), typeof(KeyboardAccelerator), KeyboardAcceleratorModifiers.None); | ||
|
|
||
| /// <summary> | ||
| /// Bindable property for <see cref="Key"/>. | ||
| /// </summary> | ||
| public static readonly BindableProperty KeyProperty = BindableProperty.Create(nameof(Key), typeof(string), typeof(KeyboardAccelerator), null); | ||
|
|
||
| /// <summary> | ||
| /// Identifies the modifiers for the keyboard accelerator. | ||
| /// </summary> | ||
| public KeyboardAcceleratorModifiers Modifiers | ||
| { | ||
| get => (KeyboardAcceleratorModifiers)GetValue(ModifiersProperty); | ||
| set => SetValue(ModifiersProperty, value); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Identifies the key for the keyboard accelerator. | ||
| /// </summary> | ||
| public string? Key | ||
| { | ||
| get => (string?)GetValue(KeyProperty); | ||
| set => SetValue(KeyProperty, value); | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,32 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.ComponentModel; | ||
| using System.Windows.Input; | ||
| using Microsoft.Maui.Controls.StyleSheets; | ||
| using System.Collections.ObjectModel; | ||
|
|
||
| namespace Microsoft.Maui.Controls | ||
| { | ||
| public partial class MenuFlyoutItem : MenuItem, IMenuFlyoutItem | ||
| { | ||
| /// <summary> | ||
| /// Represents a MenuFlyoutItem. | ||
| /// </summary> | ||
| public partial class MenuFlyoutItem : MenuItem, IMenuFlyoutItem | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new MenuFlyoutItem instance. | ||
| /// </summary> | ||
| public MenuFlyoutItem() | ||
| { | ||
| var collection = new ObservableCollection<KeyboardAccelerator>(); | ||
| collection.CollectionChanged += (sender, e) => OnPropertyChanged(nameof(KeyboardAccelerators)); | ||
| KeyboardAccelerators = collection; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the list of KeyboardAccelerators for the MenuFlyoutItem. | ||
| /// </summary> | ||
| public IList<KeyboardAccelerator> KeyboardAccelerators { get; } | ||
mattleibow marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| #if PLATFORM | ||
| IReadOnlyList<IKeyboardAccelerator>? IMenuFlyoutItem.KeyboardAccelerators => KeyboardAccelerators.AsReadOnly(); | ||
| #else | ||
| IReadOnlyList<IKeyboardAccelerator>? IMenuFlyoutItem.KeyboardAccelerators => new List<IKeyboardAccelerator>(KeyboardAccelerators); | ||
| #endif | ||
| } | ||
| } | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.