Answers for "text box on focus wpf"

C#
0

wpf how to focus on element

<StackPanel Orientation="Vertical" FocusManager.FocusedElement="{Binding ElementName=TxtB}">
    <TextBox x:Name="TxtA" Text="A" />
    <TextBox x:Name="TxtB" Text="B" />
</StackPanel>
Posted by: Guest on May-10-2021
0

textbox gotfocus wpf

private void tb_GotFocus(object sender, RoutedEventArgs e)
{
  TextBox tb = sender as TextBox;
  if (tb != null) {
    tb.SelectAll(); //select all text in TextBox
  }
}
Posted by: Guest on June-01-2020

C# Answers by Framework

Browse Popular Code Answers by Language