1
private void TextBox1_TextChanged(object sender, TextChangedEventArgs e)
{
txt1_focus.Focus();
}
我如何在wpf中使用xaml文件来实现上述代码。聚焦光标在wpf中使用xaml的文本框
private void TextBox1_TextChanged(object sender, TextChangedEventArgs e)
{
txt1_focus.Focus();
}
我如何在wpf中使用xaml文件来实现上述代码。聚焦光标在wpf中使用xaml的文本框
http://cloudstore.blogspot.com/2008/06/setting-initial-focus-in-wpf.html
这个网站介绍如何设置初始集中了一定的控制。
<Window ...
FocusManager.FocusedElement="{Binding ElementName=TextBox1}">
使用FocusManager.FocusedElement
象下面这样:
<Window x:Class="UI.Views.MyView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
FocusManager.FocusedElement="{Binding ElementName=txtSearch}">
</Window>
光标应该着眼于文本框的文本时,在文本框改变。 – Murugan 2012-08-01 18:49:35