允许数据杂志WPF中的空单元格

发布于 2025-02-07 20:21:29 字数 224 浏览 2 评论 0原文

我目前正在使用一个数据杂志,在其中将值留为几周,直到需要填充它。我的数据杂志将不允许该值为空并显示一个红色框。如何在此列中允许零值?

我试图使用validation.errortemplate =“ {x:null}”在XAML中删除所有行验证。

“”

I am currently using a datagrid where I leave the value empty for a few weeks until I need to fill it. My datagrid will not allow the value to be empty and shows a red box. How can I allow a null value in this column?

I have tried to remove all row validation with Validation.ErrorTemplate="{x:Null}" in xaml but that hasn't changed anything either.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我为君王 2025-02-14 20:21:30

我假设单元格显示了类型dateTime的值,这是一种不可删除的类型。因此,您必须有一个价值。

您可以使用String属性显示废料日期,或者使用DateTime使用dateTime进行dateTime? dateTime = null;

I assume that cell is displaying a value of type DateTime, which is a non-nullable type. Therefore you have to have a value for it.

You could either use a string property to display the scrap date, or make the DateTime nullable using DateTime? dateTime = null;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文