Search code examples
c#wpftextboxcursorradio-button

WPF Get the Cursor in the box


Hi all im having a Radio Button and Text box in front it, once i check the button the text box will become visible!

But i also want to my Cursor be visible in a text box to so easier for user to type \ how i can do these?!

thats my function

   private void SelectQualityChecked(object sender, RoutedEventArgs e)
    {
        txtSelectedQuantity.IsEnabled = true;

    }

Solution

  • Try this code:

            private void checkBox1_Checked(object sender, RoutedEventArgs e)
            {
              textBox1.IsEnabled = true;
              textBox1.Focus();
            } 
    
            private void checkBox1_Unchecked(object sender, RoutedEventArgs e)
            {
                textBox1.IsEnabled = false;
            }