gpt4 book ai didi

xaml - 在 XAML 中设置今天的日期

转载 作者:行者123 更新时间:2023-12-01 14:36:13 25 4
gpt4 key购买 nike

我想在 XAML 中显示今天的日期,然后将其返回到我的 View 模型。所以这在 XAML 中显示

<TextBlock Text="{Binding Source={x:Static sys:DateTime.Now}, StringFormat=dd/MMM/yyyy}"/>

但我想在 ModifiedDate 中返回它,所以我这样做了
<TextBlock x:Name="ModifiedDate" Text="{Binding Source={x:Static sys:DateTime.Now}, StringFormat=dd/MMM/yyyy}"/>

这不起作用。我不想使用日期选择器。我想使用 Pure XAML 并且不想去编码。有任何想法吗?

最佳答案

你必须在你的 xaml 中包含这个名字空间..如果你不能显示日期..

 xmlns:sys="clr-namespace:System;assembly=mscorlib"

如果你想要不同的东西更新你的问题..

关于xaml - 在 XAML 中设置今天的日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17648848/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com