我的问题根源是UserControl未获取相应焦点,在UserControl后台添加如下
public AccountDetailView()
{
InitializeComponent();
this.IsEnabledChanged +=new DependencyPropertyChangedEventHandler(AccountDetailView_IsEnabledChanged);
}
private void control_detail_Loaded(object sender, RoutedEventArgs e)
{
tb_detail.Focusable = true;
Keyboard.Focus(this);
}
void AccountDetailView_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (!Convert.ToBoolean(e.NewValue)) return;
this.Focusable = true;
Keyboard.Focus(this);
}