wpf,How to bind Current Date?

wpf

Solution

This will show the Current date only once .

create a namespace alias:

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


<TextBlock Text="{Binding Source={x:Static sys:DateTime.Today},   
       StringFormat='{}{0:dddd, MMMM dd, yyyy}'}"/> 

Problem

I have a TextBlock control to which I would like to bind current System Date , how can I do that by Code Behind ? The goal is to display in this TecBlock the current System Date and Time and I do not need the control refresh all the time ,only once. I hope that is most simple Code.I don't want to Create dateTime Property. follow is my code:it is Wrong that it can't find BindSource ``` Binding bd = new Binding("System.DateTime.Now"); bd.Source = this; textBox.SetBinding(TextBox.TextProperty, bd); ``` Thanks for help

Original source