How do I bind DateTime as DepedencyProperty of a DependencyObject so that it will show up in a textbox?
问题 I want to learn how to use Dependency Objects and Properties. I have created this class, public class TestDependency : DependencyObject { public static readonly DependencyProperty TestDateTimeProperty = DependencyProperty.Register("TestDateTime", typeof(DateTime), typeof(TestDependency), new PropertyMetadata(DateTime.Now)); public DateTime TestDateTime { get { return (DateTime) GetValue(TestDateTimeProperty); } set { SetValue(TestDateTimeProperty, value); } } } The window class is like this