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