2010-05-18 60 views

回答

1

也許這不是你想要的,但我已經使用它。其實你可以在你的文本框中設置FocusManager.IsFocusScope =「True」,所以它總是會把焦點放在它自己的焦點上。這意味着插入符號將始終可見。您可以啓用/禁用此類行爲FocusManager.IsFocusScope =「True」/「False」

2

這是另一種方式。選擇也將保持突出顯示。

private void MyMethod() 
{ 
    TextBox txt = ...; 
    txt.LostFocus += new RoutedEventHandler(staticTextBox_LostFocus); 
} 

private static void staticTextBox_LostFocus(object sender, RoutedEventArgs e) 
{ 
    e.Handled = true; 
}