-
Notifications
You must be signed in to change notification settings - Fork 801
Open
Open
Copy link
Labels
area-TextBoxTextBox, RichEditBoxTextBox, RichEditBoxbugSomething isn't workingSomething isn't working
Description
Describe the bug
private void TaskItemName_Enter(Microsoft.UI.Xaml.Input.KeyboardAccelerator sender, Microsoft.UI.Xaml.Input.KeyboardAcceleratorInvokedEventArgs args)
{
bool f = GridRoot.Focus(FocusState.Programmatic);
debug3.Text = "FOCUS DEBUG: " + f.ToString();
args.Handled = true;
}
Why is this important?
Focus should return true if Focus has changed (i.e. User Presses Enter on a TextBox to change the title).
Steps to reproduce the bug
- In MainWIndow.xmal add x:Name to TextBox and an other element.
- add the following xmal to TextBox
<TextBox.KeyboardAccelerators>
<KeyboardAccelerator Key="Enter" Invoked="TaskItemName_Enter"></KeyboardAccelerator>
</TextBox.KeyboardAccelerators>
- add the following code inside MainWindow.xaml.cs
private void TaskItemName_Enter(Microsoft.UI.Xaml.Input.KeyboardAccelerator sender, Microsoft.UI.Xaml.Input.KeyboardAcceleratorInvokedEventArgs args)
{
//Replace "GridRoot" with the element of your choice.
bool f = GridRoot.Focus(FocusState.Programmatic);
//either this or a debugger for the bool f.
debug3.Text = "FOCUS DEBUG: " + f.ToString();
args.Handled = true;
}
- select TextBox and press ENTER
- get the value of UIElement.Focus()
- notice TextBox does not lose focus
Actual behavior
Does not change focus despite returning true.
Expected behavior
Changes focus or returns false.
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.8.3: 1.8.251106002
Windows version
Windows 11 (24H2): Build 26100
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-TextBoxTextBox, RichEditBoxTextBox, RichEditBoxbugSomething isn't workingSomething isn't working
Type
Projects
Status
Backlog