WPF popup window's textbox not able to get input from keyboard when another application running in foreground
See original GitHub issueHi 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
{
///
}
private void btn_Click(object sender, RoutedEventArgs e)
{
popup.IsOpen = true;
}
}
} `
Issue Analytics
- State:
- Created 9 months ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thanks @lindexi 👍
Hi @lindexi I have checked your given sample it is working as expected thank you for your demo code