Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: ChildWindow FocusedElement not working as expected

$
0
0
Hi,

Here's a solution.

Right after shoing the ChildWindow, put he focus on the ChildWindow. But make sure to set the ChildWindow.FocusedElement property to your TextBox.
This way, as soon as the ChildWindow gets the focus, it will transmit it to its FocusedElement : your TextBox :
<StackPanel>
    <Button Content="Show/Hide"
            Click="Button_Click" />
    <xctk:ChildWindow x:Name="_childWindow"
                      FocusedElement="{Binding ElementName=myTextBox}">
      <TextBox x:Name="myTextBox"
               Text="MyName" />
    </xctk:ChildWindow>
    </StackPanel>
 private void Button_Click( object sender, RoutedEventArgs e )
    {
      if( _childWindow.WindowState == Xceed.Wpf.Toolkit.WindowState.Closed )
      {
        _childWindow.Show();
        _childWindow.Focus();
      }
      else
      {
        _childWindow.Close();
      }
    }
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>