這是我的數據從一個字符串(History.current_commad)到一個文本框(tbCommand)結合:WPF數據綁定不工作
history = new History();
Binding bind = new Binding("Command");
bind.Source = history;
bind.Mode = BindingMode.TwoWay;
bind.Path = new PropertyPath("current_command");
bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
// myDatetext is a TextBlock object that is the binding target object
tbCommand.SetBinding(TextBox.TextProperty, bind);
history.current_command = "test";
history.current_command正在改變,但文本框沒有被更新。哪裏不對?
感謝
「歷史」課程是什麼樣的? – dlev
public class History {public string current_command; } – Charlie