更新时间:2022-05-23 22:40:55
当按钮代码>焦点变化
示例:
<StackPanel>
<TextBox Name="txtbx" />
<Button Content="Click Me!" FocusManager.FocusedElement="{Binding ElementName=txtbx}"/>
</StackPanel>
使用此解决方案,即使按下 Button
和 TextBox
LostFocus
也将始终聚焦 TextBox
> 事件不会被触发
With this solution the The TextBox
will always be focused even when the Button
is pressed and the TextBox
LostFocus
event will not be fired