我有一个WPF应用程序,它读取一个巨大的文本文件并将其显示到文本框,但我需要知道在将规范化按钮更改为可见之前已读取所有文件。
我的问题是如何知道所有文件都已在文本框中读取并显示(意味着文本框仍在更改)并且只是在将按钮指定为可见之后?
try
{
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true)
{
using (StreamReader sr = new StreamReader(openFileDialog.FileName))
{
FileBuff = await sr.ReadToEndAsync();
txtEditor.Text = FileBuff;
Normalize_button.IsEnabled = true;
}
}
}
catch (Exception ex)
{
UiInvoke(() => txtEditor.Text = "Could not read the file");
}
答案 0 :(得分:1)
在XAML中绑定BigText
我也会绑定按钮IsEnabled
Private Sub s_Description_DblClick(Cancel As Integer)
If Me.OrderBy = "Description" Then
Me.OrderBy = "Description DESC"
Else
Me.OrderBy = "Description"
End If
Me.Requery
End Sub
但是您应该使用后台工作程序,因此您有一个回调事件(OnCompleted)
您还可以选择取消后台工作人员
查看优先级绑定