我试图将日期时间设置到文本框中,但是出现了异常:System.Windows.Data.Binding.Path' threw an exception。
如果我使用TextBlock,一切都正常。
希望能得到任何帮助。
谢谢。
xmlns:sys="clr-namespace:System;assembly=mscorlib"
<TextBlock Name="block" Text="{Binding Source={x:Static sys:DateTime.Now}, StringFormat='yyyy-MM-dd HH:mm:ss '}"/>
<TextBox Name="block1" Text="{Binding Source={x:Static sys:DateTime.Now}, StringFormat='yyyy-MM-dd HH:mm:ss '}"/>