question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WPF popup window's textbox not able to get input from keyboard when another application running in foreground

See original GitHub issue

Hi I have create a normal popup window with textbox but textbox not taking any input when another process or application running on foreground of our Wpf window.

Step for reproduced 1.Launch application 2.Open popup window 3.Maximize window 4.Go to other application like window file explorer. 5.Try to type something on popup window

**sample program for popup window ** `<Window x:Class="WPFPopup.Window3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WPFPopup" mc:Ignorable="d" Title="Window3" Height="450" Width="800"> <Grid> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions>

    <Button x:Name="btn" Content="Open Search Window"  Height="30" Width="150" Click="btn_Click"/>

    <Popup x:Name="popup"  PlacementTarget="{Binding ElementName=btn}" Placement="Bottom"  Width="200" Height="100" Margin="0,20,0,0">
        <Border BorderBrush="Black" BorderThickness="2" Background="AliceBlue">
            <TextBox x:Name="txtBox" VerticalAlignment="Center" Margin="15,0,15,0"/>
        </Border>
    </Popup>

  
</Grid>
</Window> ` _**cs code**_ `using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes;

namespace WPFPopup { ///

/// Interaction logic for Window3.xaml /// public partial class Window3 : Window { public Window3() { InitializeComponent();

    }
   
    private void btn_Click(object sender, RoutedEventArgs e)
    {
        popup.IsOpen = true;
    }
}

} `

Issue Analytics

  • State:closed
  • Created 9 months ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pchaurasia14commented, Dec 21, 2022

Thanks @lindexi 👍

1reaction
sachinkumarrajakcommented, Dec 21, 2022

@sachinkumarrajak Could you try my demo code: https://github.com/lindexi/lindexi_gd/tree/1666e742fbd5ebda36e840a8e5f4b866251b3004/GakelfojeNairwogewerwhiheecem ?

Hi @lindexi I have checked your given sample it is working as expected thank you for your demo code

Read more comments on GitHub >

github_iconTop Results From Across the Web

Textbox in popup doesn't get focus in WPF application
So I tried just not opening the keyboard, and I was able to click on the textbox and give it focus without having...
Read more >
Text box is not working in WPF Popup
The reason for that is that the Popup control is used for tooltips and other static displays (like images), NOT for input.
Read more >
[WPF] Soft Keyboard Shows, Then Hides, in Popup Window
It seems that only TextBoxes on Popup windows have the issue. The soft keyboard appears to work OK with TextBoxes in my main...
Read more >
How to get caret position in ANY application from C#? - ...
I'm trying to get caret position in windows. Even if it's not native. Tried to use Win32 API GetCaretPos function (https://learn.microsoft.com/ ...
Read more >
TextBox in Popup Disabled if there is no Parent Window
This behavior goes back to the original intent of Popups, which is to support menus and context menus. In talking with the WPF...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found