Clyde Eisenbeis

Clyde Eisenbeis

  • 1.7k
  • 63
  • 11.4k

How do I have the first keyboard entries start in a specific TextBox?

Mar 12 2024 3:04 PM

C# wpf --- How do I have the first keyboard entries start in a specific TextBox when the dialog box is opened?  TabIndex does not do that.

<StackPanel Orientation="Vertical">
    <Label Content="Players" 
                    Margin="0,20,0,0"
                    HorizontalAlignment="Center" />
    <TextBox x:Name="gTBxNumberOfPlayers" 
                        Margin="0,-2,0,0" 
                        Width="30"
                        HorizontalAlignment="Center" 
                        TabIndex="1"/>
    <Label Content="Cities" 
                    Margin="0,0,0,0"
                    HorizontalAlignment="Center" />
    <TextBox x:Name="gTBxNumberOfCities" 
                        Margin="0,-2,0,0" 
                        Width="30"
                        HorizontalAlignment="Center" 
                        TabIndex="2"/>
    <Button x:Name="gBuCaptureNumbers" 
                    Content="Capture" 
                    Margin="0,10,0,0" 
                    Width="100"
                    HorizontalAlignment="Center" 
                    IsDefault="True"
                    Click="gBuCaptureNumbers_Click" />
</StackPanel>

 


Answers (2)