Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting today's date in XAML

I want to display today's date in XAML and then return that to my view model. So this shows it in XAML

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

but I want to return it in ModifiedDate, so I did this

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

This doesn't work. I don't want to use datepicker. I want to use Pure XAML and do not wish to go to code. Any ideas?

like image 223
munchine Avatar asked Oct 04 '22 13:10

munchine


1 Answers

you have to include this name space in your xaml..if you are not able to show date..

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

and if you want something different update your question..

like image 200
loop Avatar answered Oct 07 '22 21:10

loop