3

When we select any of the TreeNode in WindowsFormHost and then try to type text in textbox shown in popup does not allow to add text since the focus is not lost from the TreeNode. Can i get suggestion on this ?

Code Snippet :

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wind="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Popup Width="250" Height="300" StaysOpen="True" IsOpen="True">
            <TextBox Width="100" Height="100"/>
        </Popup>
        <WindowsFormsHost Width="200">
            <wind:TreeView>
                <wind:TreeView.Nodes>
                    <wind:TreeNode Text="Node 1"/>
                    <wind:TreeNode Text="Node 2"/>
                    <wind:TreeNode Text="Node 3"/>
                    <wind:TreeNode Text="Node 4"/>
                </wind:TreeView.Nodes>
            </wind:TreeView>
        </WindowsFormsHost>
    </Grid>
</Window>

Sample Link :

http://www.syncfusion.com/downloads/Support/DirectTrac/85553/WpfApplication21123581705.zip

H.B.
  • 166,899
  • 29
  • 327
  • 400
Magesh
  • 121
  • 4

1 Answers1

0

Controls in a Popup is not concidered part of the Popup's parent.

So you must first set focus to the Popup itself, and then find the TextBox control within the Popup and focus it (find Popup-child by x:Name and set focus)

Mats Magnem
  • 1,375
  • 1
  • 10
  • 21