2
,我可以把今天的日期在標籤中沒有XAML綁定它,像DateTime.Now在XAML沒有約束力
<Label Text="DateTime.Now, StringFormat='{0:MMMM dd, yyyy}'"/>
感謝
,我可以把今天的日期在標籤中沒有XAML綁定它,像DateTime.Now在XAML沒有約束力
<Label Text="DateTime.Now, StringFormat='{0:MMMM dd, yyyy}'"/>
感謝
,我可以把今天的日期xaml中沒有綁定的標籤
不,你不能。
綁定,使用
xmlns:sys="clr-namespace:System;assembly=mscorlib"
與
<Label Content="{Binding Source={x:Static sys:DateTime.Now}, StringFormat='{0:MMMM dd, yyyy}'}" />
雖然,你可以從代碼設置它的背後像myLabelControl.Content = DateTime.Now;
,但我會完全避免這種情況。
謝謝,它適用於我 – Mireille
此綁定不更新時間。如果我添加新的標籤,它顯示以前的日期 –
我使用.NetStandard所以我用這個: 'xmlns:sys =「clr-namespace:System; assembly = netstandard」 –