I have a TextBlock control to which I would like to bind the current System date, how can I do this with code?
The goal is to display the current System date and time in this TecBlock, and I do not need to update the control all the time, only once.
I hope this is the easiest code. I do not want to create a DateTime property. follow is my code: it is not true that it cannot find BindSource
Binding bd = new Binding("System.DateTime.Now");
bd.Source = this;
textBox.SetBinding(TextBox.TextProperty, bd);
thanks for the help
source
share