-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
ComboBox will not show dropdown while in a TextBox InnerLeftContent #17644
Comments
The Avalonia/src/Avalonia.Controls/ComboBox.cs Lines 309 to 312 in ab1d77a
I don't know of a reasonable workaround until the bug is fixed. Repro without bindings: <StackPanel>
<TextBox
VerticalContentAlignment="Center"
IsHitTestVisible="True"
Watermark="http://">
<TextBox.InnerLeftContent>
<ComboBox
Width="100"
Margin="4"
AutoScrollToSelectedItem="True"
IsHitTestVisible="True">
<TextBlock Text="https" />
<TextBlock Text="http" />
<TextBlock Text="ftp" />
</ComboBox>
</TextBox.InnerLeftContent>
<TextBox.InnerRightContent>
<StackPanel
Margin="4"
Orientation="Horizontal"
Spacing="4">
<Button Content="POST" />
<Button Content="GET" />
</StackPanel>
</TextBox.InnerRightContent>
</TextBox>
<ComboBox
Width="100"
Margin="4"
AutoScrollToSelectedItem="True"
IsHitTestVisible="True">
<TextBlock Text="https" />
<TextBlock Text="http" />
<TextBlock Text="ftp" />
</ComboBox>
</StackPanel> |
@stevemonaco Thanks for helping me to figure out why inner combobox not showing its dropdown. |
There's a pretty hacky workaround with event subscriptions. Building from the example above, naming the public MainWindow()
{
InitializeComponent();
var left = textbox.InnerLeftContent as Control;
left?.AddHandler(PointerPressedEvent, InnerLeftContent_PointerPressed, RoutingStrategies.Bubble);
}
private void InnerLeftContent_PointerPressed(object? sender, PointerPressedEventArgs e)
{
e.Handled = true;
} Handling the event here will not allow the |
Describe the bug
I put a ComboBox inside TextBox.InnerLeftContent. The ComboBox dropdown didn't show itself when I click on the ComboBox.
To Reproduce
The text was updated successfully, but these errors were encountered: