I have a textbox I want to bind to DateTime property to an object :
myTextBox.DataBindings.Add("Text",myObject,"DateTimeProperty")
myTextBox.DataBindings["Text"].FormatString = "HH:mm";
myTextBox.DataBindings["Text"].FormattingEnabled = true;
myTextBox.DataBindings["Text"].BindingComplete +=
delegate(object sender, BindingCompleteEventArgs e)
{
if (e.Exception is FormatException)
MessageBox.Show("Wrong formating, should be :" +myTextBox.DataBindings["Text"].FormatString);
};
This works perfectly, when I change the textbox value, the property change. Now I want the reverse (without parsing the text).
I want to add a button that increment by 1 minutes myObject.DateTimeProperty. The issue is I can't do
myObject.DateTimeProperty.Minutes+=1;
nor
myObject.DateTimeProperty = myObject.DateTimeProperty.AddMinutes(1);
Any ideas?
myobjoect是否实现INotifyPropertyChanged吗?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.