microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.24k stars 672 forks source link

CharacterReceived event is not working in WinUI 3 ComboBox #9786

Closed Ajith-GS closed 1 month ago

Ajith-GS commented 1 month ago

Describe the bug

The CharacterReceived event is not calling while typing characters in editable ComboBox. Sample code is given below.

 <ComboBox x:Name="TEST" IsEditable="True" CharacterReceived="ComboBox_CharacterReceived" >
     <x:String>123</x:String>
     <x:String>234</x:String>
     <x:String>125</x:String>
 </ComboBox>
void winrt::TestApp::implementation::MainWindow::ComboBox_CharacterReceived( winrt::Microsoft::UI::Xaml::UIElement const& sender, winrt::Microsoft::UI::Xaml::Input::CharacterReceivedRoutedEventArgs const& args )
{
    OutputDebugString( (L"\nComboBox_CharacterReceived" );
}

Is there any additional stuff We should do to trigger this event? Any help is greatly appreciated.

Steps to reproduce the bug

Create a C++ WinUI3 application. Add a ComboBox control in XAML. Add CharacterReceived event. Put OutputDebugString inside the CharacterReceived handler.

Expected behavior

While typing characters, the CharacterReceived event should be triggered each time.

Screenshots

No response

NuGet package version

Windows App SDK 1.5.4: 1.5.240607001

Packaging type

Packaged (MSIX)

Windows version

Windows 10 version 22H2 (19045, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

jususnja-ms commented 1 month ago

I have a similar problem. But seems to me that character received works for some elements and for some it doesn't. It doesn't get invoked for Window element or for TextBox. But it did get invoked for Button. Ideally, I would like to make it work for Window element somehow.