The type of the Calendar.SelectedDate
property is Nullable<DateTime>
. Hence you have to access the contained DateTime
by the Nullable<T>.Value
property:
if (calendar_odevzdani.SelectedDate.HasValue)
{
datum_odevzdani.Text = calendar_odevzdani.SelectedDate.Value.ToString("dd/MM/yyyy");
}