wpf 窗口打开后默认设置控件焦点
https://blog.csdn.net/Vblegend_2013/article/details/81771872
<Grid FocusManager.FocusedElement="{Binding ElementName=pwd}">
<Grid.RowDefinitions>
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<Button Style="{StaticResource CloseImageButtonStyle}" HorizontalAlignment="Right"
Margin="0,0,5,0"
IsCancel="True"
Command="{Binding CloseCommand}" />
<DockPanel Margin="45,0" Grid.RowSpan="2" VerticalAlignment="Center">
<Button
IsDefault="True"
DockPanel.Dock="Right" Margin="10,0,0,0" Style="{StaticResource NormalButtonStyle}" Content="确定"
Command="{Binding ConfirmCommand}" />
<PasswordBox
x:Name="pwd"
converter:PasswordBoxHelper.Password="{Binding Password,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Height="30" Style="{StaticResource DefaultPasswordBoxStyle}" />
</DockPanel>
</Grid>