public void TestSetFocus() { var textBox = new TextBox(); textBox.SetBinding(FocusExtension.IsFocusedProperty, new Binding("IsFocused") { Source = this }); Assert.IsNotNull(FocusExtension.GetIsFocused(textBox)); Assert.IsFalse(textBox.IsFocused); this.IsFocused = true; Assert.IsTrue(textBox.IsFocused); }
private void OnFocusLost(object sender, RoutedEventArgs e) { FocusExtension.SetIsFocused(( FrameworkElement )sender, false); }