这只是每次将文本框中的文本写入同一个文件......我不明白为什么如果我输入新字符或更改字符而删除字符不起作用,它为什么能完美工作......
private void ContentChanged(object sender, TextChangedEventArgs e)
{
Console.WriteLine("cur before:" + this.Box.SelectionStart);
FileStream f = File.Open(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite);
StreamWriter writer = new StreamWriter(f);
model.Cursor = this.Box.SelectionStart;
writer.Write(this.Box.Text);
writer.Close();
Console.WriteLine("cur after:" + this.Box.SelectionStart);
Console.WriteLine("write:" + count++);
Console.WriteLine("after write:" + this.Box.Text);
Console.WriteLine("after write:" + model.Content);
}