Custom DateTime column in Data Grid

I have a model with a DateTime? field.

If I assign this to be a column in a Data Grid, the full date is shown. In order to only show the short date, I can use the FormatString property of the column.

Now, I want to display a Badge (control) next to the date if the date is < DateTime.Now.

My idea was to create a Template for the column with a Label and a Badge control. The Text property of the Label should show the short date and the Visible property of the Badge is bound to my expression that checks if the date is < DateTime.Now.

My problem is that I cannot assign the Text property of the label with the DateTime? object, even if I use ToString() or String.Format().

How can I create such a template that shows the date as well as the badge?

Not sure why you cannot, can you clarify? string.Format() is actually the only way to apply desired format and you can use it as expression for Label Text property.

You are right. I had to fiddle around with the syntax a bit, but now, this is working as expected:

${String.Format("{0:d}", data.MyDateTimeFiled)}

Thanks for your excellent and quick support!