我在SQL Server中将表的DataType设置为Date
,但在WPF文本框中显示了DateTime
,但是我不确定如何格式化文本框或SQL Server以仅显示Date
。
我尝试使用DatePicker
而不是TextBox
,但我需要将其设置为ReadOnly,并且当DatePicker
设置为NOT ENABLED且没有ReadOnly选项时,它会变成灰色。
如何仅在TextBox
中显示短日期?
我认为这段代码应该可以解决您的问题:
<TextBox Text="{Binding PropertyPath, StringFormat=d}" />