public void NullableDoubleNotNull() { var vm = new DummyViewModel { NullableDoubleValue = 1 }; var textBox = new System.Windows.Controls.TextBox { DataContext = vm }; var binding = new Binding { Path = new PropertyPath(DummyViewModel.NullableDoubleValuePropertyName), Mode = BindingMode.TwoWay }; BindingOperations.SetBinding(textBox, Input.ValueProperty, binding); textBox.RaiseLoadedEvent(); textBox.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent)); Assert.AreEqual(typeof(double?), textBox.GetSourceValueType()); vm.NullableDoubleValue = 1; Assert.AreEqual(typeof(double?), textBox.GetSourceValueType()); }