mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 09:28:03 +08:00
[Quick Accent]Fix the first character selection in the toolbar (#22808)
This commit is contained in:
parent
57bde1c54c
commit
0de7781b51
@ -3,14 +3,9 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Unicode;
|
||||
using System.Windows;
|
||||
using PowerAccent.Core.Services;
|
||||
using PowerToys.PowerAccentKeyboardService;
|
||||
using Point = PowerAccent.Core.Point;
|
||||
using Size = PowerAccent.Core.Size;
|
||||
|
||||
@ -22,6 +17,8 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
|
||||
|
||||
private Visibility _characterNameVisibility = Visibility.Visible;
|
||||
|
||||
private int _selectedIndex = 0;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public Visibility CharacterNameVisibility
|
||||
@ -55,9 +52,9 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
|
||||
|
||||
private void PowerAccent_OnSelectionCharacter(int index, string character)
|
||||
{
|
||||
characters.SelectedIndex = index;
|
||||
|
||||
characterName.Text = _powerAccent.CharacterDescriptions[index];
|
||||
_selectedIndex = index;
|
||||
characters.SelectedIndex = _selectedIndex;
|
||||
characterName.Text = _powerAccent.CharacterDescriptions[_selectedIndex];
|
||||
}
|
||||
|
||||
private void PowerAccent_OnChangeDisplay(bool isActive, string[] chars)
|
||||
@ -67,7 +64,7 @@ public partial class Selector : Window, IDisposable, INotifyPropertyChanged
|
||||
if (isActive)
|
||||
{
|
||||
characters.ItemsSource = chars;
|
||||
characters.SelectedIndex = 0;
|
||||
characters.SelectedIndex = _selectedIndex;
|
||||
this.UpdateLayout(); // Required for filling the actual width/height before positioning.
|
||||
SetWindowPosition();
|
||||
SetWindowAlignment();
|
||||
|
Loading…
Reference in New Issue
Block a user