Home > database >  adding DateTime.Now into Xaml file in xamarion.forms
adding DateTime.Now into Xaml file in xamarion.forms

Time:02-23

I'm trying to add DateTime.Now in xamarin.forms in xaml Page i wrote this code :

<DatePicker  Grid.Column="0" Grid.Row="0" FontSize="Small" Date=DateTime.Now.ToString("dd'/'MM'/'yyyy HH:mm:ss") Format="d"></DatePicker>

But it's gave an error in DateTime.Now.ToString("dd'/'MM'/'yyyy HH:mm:ss")

section, it say :

Invalid value for Priority 'Date' : 'DateTime.Now.ToString' and many other errors appear, how can i solve it ?

CodePudding user response:

xaml:

<DatePicker Date="{x:Static system:DateTime.Today}" />

Add please:

xmlns:system="clr-namespace:System;assembly=mscorlib"
  • Related